[BGL] Multiple adaptations of graph
Hi, I have a simple directed graph class (let's call it MyGraph) which I want to adapt for BGL algorithms. I've defined the necessary traits and functions (in_edges, target etc.) and everything works fine. Problem is I want to be able to treat the graph as an undirected graph as well when using some of the BGL algorithms, but since the graph_traits are only templatized on the graph type I can't define a new set of traits since graph_traits<MyGraph> is already defined. The only solution I've come up with so far (after 10 minutes of thinking :) is to define a new class, MyDirectedGraph, which is an exact copy of MyGraph and define a set of traits for this new class. And then when I want to use the undirected version of the algorithms on my MyGraph object I cast it to a MyDirectedGraph. Somehow I have a feeling there must be a more robust and elegant way to solve this problem. Regards /A.B. ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.f-secure.com/
participants (1)
-
Andreas Brinck