Graph.incidentEdges

Returns a range of all edges incident to node n.

  1. auto incidentEdges(Node n)
    struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)
    incidentEdges
    nothrow pure
    (
    Node n
    )
  2. auto incidentEdges(Node n)
  3. alias inEdges = incidentEdges
  4. alias outEdges = incidentEdges

Examples

1 import std.algorithm : equal;
2 
3 auto g1 = Graph!int([1, 2, 3]);
4 
5 g1 ~= g1.edge(1, 1);
6 g1 ~= g1.edge(1, 2);
7 g1 ~= g1.edge(2, 2);
8 g1 ~= g1.edge(2, 3);
9 
10 assert(g1.incidentEdges(1).equal([
11     g1.edge(1, 1),
12     g1.edge(1, 2),
13 ]));
14 assert(g1.incidentEdges(2).equal([
15     g1.edge(1, 2),
16     g1.edge(2, 2),
17     g1.edge(2, 3),
18 ]));
19 assert(g1.incidentEdges(3).equal([
20     g1.edge(2, 3),
21 ]));

Meta