Search code examples
c++boostdictionaryboost-graph

BGL graph with map on edges list


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:

  1. Is it possible to use std::map? If yes how?
  2. How can I iterate throught inputs of vertex when using std::map?
  3. If the above is impossible, how can I implement structures that suits the problem?

Thank you!


Solution

  • I finally switched to Lemon graph library which is not as hacky as BGL