Graph.outEdges

Returns a range of in/outgoing edges of node n.

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

Examples

1 import std.algorithm : equal;
2 
3 auto g1 = Graph!(int, void, Yes.isDirected)([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.inEdges(1).equal([
11     g1.edge(1, 1),
12 ]));
13 assert(g1.outEdges(1).equal([
14     g1.edge(1, 1),
15     g1.edge(1, 2),
16 ]));
17 assert(g1.inEdges(2).equal([
18     g1.edge(1, 2),
19     g1.edge(2, 2),
20 ]));
21 assert(g1.outEdges(2).equal([
22     g1.edge(2, 2),
23     g1.edge(2, 3),
24 ]));
25 assert(g1.inEdges(3).equal([
26     g1.edge(2, 3),
27 ]));
28 assert(g1.outEdges(3).empty);

Meta