Read graph empty?

Hi, can you tell me what I am doing wrong in the attached code?

The graph I used can be found here:
www.tessarakt.de/stuff/planar100k.graphml.zip (1,5 MB ...)

When I run it, it says

$ ./1
#vertices: 0
make_map_as_colormap entered
writing something to MapAsColorMap
Speicherzugriffsfehle

The crash is due to the empty graph ...

It should be possible to add vertices to adjacency_list<vecS, vecS,
bidirectionalS, VertexProperties, EdgeProperties>?!?!

Cheers,

Jens

1.cpp (2.32 KB)

bfs_distmap_as_color_map.hpp (3.34 KB)

Jens Müller wrote:

Hi, can you tell me what I am doing wrong in the attached code?

The graph I used can be found here:
www.tessarakt.de/stuff/planar100k.graphml.zip (1,5 MB ...)

When I run it, it says

$ ./1
#vertices: 0
make_map_as_colormap entered
writing something to MapAsColorMap
Speicherzugriffsfehle

The crash is due to the empty graph ...

I tried your first example graph at
https://projects.forked.de/graph-tool/wiki/GraphToolGuide#Fileformatdescription

That gives me:

terminate called after throwing an instance of 'boost::property_not_found'
   what(): Property not found: weight.

My dynamic properties are:

   dynamic_properties dp;
   dp.property("coord1", get(&VertexProperties::x, g));
   dp.property("coord2", get(&VertexProperties::y, g));
   dp.property("length", get(&EdgeProperties::length, g));

So I think this error message is a bit strange ...

Reading the 2nd example with edgedefault="undirected" changed to
"directed" seems to work, even with the dp as above.

Reading the 1st example btw does not even work with an empty dp object.

Somehow you seem to have a hard-coded weight property?

The reader will always try to put a property it finds in the file in the
dynamic_properties you pass to it. If the property doesn't exist
already, it is up to the dynamic_property object to create it or not. By
default it throws an exception, instead of creating. You need to supply
it with a function in the constructor that will create it automatically.
Take a look at:

http://www.boost.org/libs/property_map/doc/dynamic_property_map.html#member-functions

Tiago de Paula Peixoto schrieb:

The reader will always try to put a property it finds in the file in the
dynamic_properties you pass to it. If the property doesn't exist
already, it is up to the dynamic_property object to create it or not. By
default it throws an exception, instead of creating. You need to supply
it with a function in the constructor that will create it automatically.
Take a look at:

Boost Dynamic Property Maps - 1.84.0

Sorry, yeah ... I think we got that topic already ... Nevertheless, I
don't understand the fundamental differences of your GraphML files and
mine that would make the reader do strange things, like not adding
vertices ...

Jens Müller schrieb:

Tiago de Paula Peixoto schrieb:

The reader will always try to put a property it finds in the file in the
dynamic_properties you pass to it. If the property doesn't exist
already, it is up to the dynamic_property object to create it or not. By
default it throws an exception, instead of creating. You need to supply
it with a function in the constructor that will create it automatically.
Take a look at:

Boost Dynamic Property Maps - 1.84.0

Sorry, yeah ... I think we got that topic already ... Nevertheless, I
don't understand the fundamental differences of your GraphML files and
mine that would make the reader do strange things, like not adding
vertices ...

OK, it was due to the strange namespace declaration in my files:

Yours:

<graphml xmlns="http://graphml.graphdrawing.org/xmlns&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd&quot;&gt;

Mine:

<graphml
xmlns="http://graphml.graphdrawing.org/xmlns/1.0rc&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/1.0rc
                    graphml-structure-1.0rc.xsd

              http://graphml.graphdrawing.org/xmlns/1.0rc
                    graphml-attributes-1.0rc.xsd"

Sorry for the bother ... With your version, it works fine.

Good you figured it out... I'm completely out of time currently, that's
why I didn't look at it carefully. Fell free to ask about any other
problem you may have.

Cheers.