Search code examples
c++graphlemon-graph-library

Finding the Nodes of an Edge in LEMON graph library


Suppose that I have an Edge. How can I easily find which two nodes it connects? The documentation of LEMON is so sparse, I could not find info on this.


Solution

  • You can use source and target to find the nodes an edge connects, it works like this

    ListDigraph graph;
    ListDigraph::Arc edge;
    ListDigraph::Node a1,a2;
    a1 = graph.source(edge);
    a2 = graph.target(edge);