graphlib icon indicating copy to clipboard operation
graphlib copied to clipboard

Sinks method returns incorrect output for undirected graph

Open lynxaegon opened this issue 6 years ago • 0 comments

Hi,

{ options: { directed: false, multigraph: false, compound: false },
  nodes:
   [ { v: 'a' },
     { v: 'b' },
     { v: 'c' },
     { v: 'd' } ],
  edges:
   [ { v: 'a', w: 'b' }, { v: 'b', w: 'c' }, { v: 'c', w: 'd' } ] }

This is how i define the graph:

var g = new graphlib.Graph({
	directed: false
});

g.setEdge("a", "b");
g.setEdge("b", "c");
g.setEdge("c", "d");
g.sinks() -> returns "d"

The graph is undirected, wouldn't that mean that "d" is connected to "c"?

lynxaegon avatar Apr 23 '19 16:04 lynxaegon