Boost Graph write_grahml - wrong source- and target-ID's in edge of XML-File

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Boost Graph write_grahml - wrong source- and target-ID's in edge of XML-File

Boost - Users mailing list
Hi there,

I want to create an xml-file out of my Graph... So I'm using the
write_graphml Function with dynamic_properties. Everything is fine, I get a
file, but there are wrong source- and target- ID's in the edge structs ...

Here an example:

 <node id="n1">
      <data key="key0">vertex_7</data>
      <data key="key2">bf88aa63-bff1-5c04-8daf-37a5e31981f6</data>
      <data key="key6">12.5</data>
      <data key="key7">7.5</data>
    </node>

    <edge id="e1" source="n1" target="n2">
      <data key="key1">edge_4_5</data>
      <data key="key3">26c512cb-46d8-5eb5-8021-2aac9f492227</data>
      <data key="key4">45844430-f1ea-5355-b7ce-eb566fe89256</data>
      <data key="key5">ecac63d6-e531-5ce8-9578-13cb63d040de</data>
    </edge>

In the edge there is the wrong source-ID - it should be the ID of Vertex 4
(source="n0") not 7 (source="n1")

My Graph:

struct vertex
{
   float x;
   float y;
   string name;
   string uuid;
};

struct edge
{
   string source_v_uuid; //startpoint uuid
   string target_v_uuid; //endpoint uuid
   string name; // name - edge_from_src-Vertex_to_dest-Vertex
   string uuid;
};

typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
vertex, edge> myGraph;

And my Properties:

 boost::dynamic_properties dyn_p;
         // fill vertex properties
         dyn_p.property("name", get(&vertex::name, graph));
         dyn_p.property("x-value", get(&vertex::x, graph));
         dyn_p.property("y-value", get(&vertex::y, graph));
         dyn_p.property("uuid", get(&vertex::uuid, graph));
         // fill edge properties
         dyn_p.property("name", get(&edge::name, graph));
         dyn_p.property("v-src-uuid", get(&edge::source_v_uuid, graph));
         dyn_p.property("v-dest-uuid", get(&edge::source_v_uuid, graph));
         dyn_p.property("uuid", get(&edge::uuid, graph));

         write_graphml(ofs, graph, dyn_p, true);


I tried to create a property map by myself to set the UUID as the (vertex
(source/target)) -ID's, but that changed nothing, there are still wrong
source- and target- ID's in the edge struct.

         auto map = get(&vertex2::uuid, graph);
         write_graphml(ofs, graph, map, dyn_p, true);

Can anybody help me? Or even give me a hint to figure out what is going
wrong?



--
Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users