Extending boost graph edge class
Hi,My name is Rafael and I need to extend the edge class of de graph part of the boost lib, but I always find problems trying to do this. Can you help me with examples and explanations about how to do this?I read a lotação of places trying to do this but no help was found, please help me. Thanks a lot,Rafael
Can you elaborate on "extend the edge class"? Here are some possible interpretations: 1/ You want to optimize the memory consumption for large graphs. The edges and vertices still fit into uint32_t: using graph_t = compressed_sparse_row_graph<directedS, no_property, no_property, no_property, uint32_t /* Vertex */, uint32_t /* EdgeIndex */>; 2/ You want to store arbitrary metadata on your edges and retrieve this edge data based on your graph and a specific edge descriptor: struct edge_data_t { int distance = 0; }; using graph_t = compressed_sparse_row_graph<directedS, no_property, edge_data_t>; // .. auto duration = [&graph](auto edge) { return graph[edge].duration; }; auto total = accumulate(edges(graph) | transformed(duration), 0); This example is using "bundled properties". There is also the possibility to store edge data external to the graph and not couple the edge data's lifetime with the graph (e.g. if you need edge weights for a particular algorithm in your use-case). 3/ You want to provide your own graph representation and make it a model for the BGL graph concepts: http://www.boost.org/doc/libs/1_60_0/libs/graph/doc/leda_conversion.html http://www.boost.org/doc/libs/1_60_0/libs/graph/doc/graph_concepts.html Here are some more BGL examples that should get you started: https://github.com/daniel-j-h/cppnow2016 Cheers, Daniel J H On 05/03/2016 08:37 AM, Rafael Gasperetti wrote:
Hi, My name is Rafael and I need to extend the edge class of de graph part of the boost lib, but I always find problems trying to do this. Can you help me with examples and explanations about how to do this? I read a lotação of places trying to do this but no help was found, please help me.
Thanks a lot, Rafael
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Daniel Hofmann
-
Rafael Gasperetti