I am the using LEMON Graph library and was wondering if there is an efficient way to receive a ListDigraph::Node x via the value of its corresponding ListDigraph::NodeMap?
I was thinking about something like:
lemon::ListDigraph lg;
lemon::ListDigraph::NodeMap<std::string> nodeColor(lg);
lemon::ListDigraph::Node n = lg.addNode();
nodeColor[n] = "red";
lemon::ListDigraph::Node m = lg.addNode();
nodeColor[m] = "green";
# now I'd like to have something like:
lemon::ListDigraph::Node x = nodeColor.getNodeFromColor("red");
Does something like this already exist in LEMON? If there is no other way than writing my own map, how do I return the key (Node)? Can I iterate over the underlying values of the map?
Unfortunately, it is not possible to obtain the keyset (or the respective nodes) from Lemon's
NodeMap, see the NodeMap reference.There is also no way to iterate over the map. The best way to overcome this is to write your own map, as you write yourself, or use additional helper maps (or similar containers).