Graph.indexOf

Returns the index of node n in the list of nodes.

  1. size_t indexOf(in Node n)
  2. size_t indexOf(in Edge edge)
    struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)
    size_t
    indexOf
    const
    ()

Examples

1 auto g1 = Graph!(int, int)([1, 2]);
2 
3 auto e1 = g1.edge(1, 2, 1);
4 
5 g1 ~= e1;
6 
7 assert(g1.indexOf(g1.edge(1, 2)) == 0);
8 assertThrown!MissingEdgeException(g1.indexOf(g1.edge(1, 1)));

Meta