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 ]));
Returns a range of all edges incident to node n.