Reputation: 2947
I'm trying to create some specific structure with Boost Graph Library. I need to have nodes (vertexes) with input and output ports. Each ouput port could be connected to any input port of other node. I want to be able to check if specific output or input port is connected to any other port.
The idea is to use std::map as OutEdgeList inside of adjacency_list.
According to: http://www.boost.org/doc/libs/1_52_0/libs/graph/doc/using_adjacency_list.html#sec:choosing-graph-type I'm only able to select one of std::vector, std::list, std::slist, std::set, std::multiset and std::hash_set. (you can choose mapS as a type but it is implemented as std::set and I cannot get the value by key)
And I have a couple of questions:
Thank you!
Upvotes: 2
Views: 303
Reputation: 2947
I finally switched to Lemon graph library which is not as hacky as BGL
Upvotes: 2
Reputation: 10557
I do not see reasons why map cannot be used as data structure to store outgoing edges. Map has iterators that work in the similar way to say std::vector
, etc. To handle incoming edges you will need 2 maps on each vertex. AFAIK BGL supports both lists on vertexes.
I would recommend you to modify (hack) BGL and see what will happen. The change might be not small. You will have to provide adjacency_list specializations for your new type of container. Most likely this will work.
Upvotes: 0