How to find neighbors from node in lemon

In the Lemon C ++ diagram library given by a node in an undirected graph, how do I find other nodes that are connected by edges?

+4
source share
1 answer

I will go for it, although I am rusty with C ++ and have not used Lemon before:

for (ListDigraph::OutArcIt arcIt(graph, node); arcIt != INVALID; ++arcIt) { Arc arc(*arcIt); // Lemon iterators are supposed to be convertible to items // without operator*, so arc(a) might work too. Node oppositeNode( g.oppositeNode(node, arc) ); // Do something with the opposite node. ... } 

I used this: LEMON - C ++ open source template library

... and this: LEMON: Graph class reference

... and for many years I worked on graph theory.

Hope this helps.

+4
source

All Articles