dagrejs / graphlib

A directed multi-graph library for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

findCycles ignores self-referencing cycles for graphs with named edges

hcomnetworkers opened this issue · comments

The "findCycles" algorithm does currently not return any cycles caused by self referencing nodes.

Example

const graph = new graphlib.Graph({ multigraph: true });
graph.setNode('node1');
graph.setEdge('node1', 'node1', null, 'edge1');
const cycles = graphlib.alg.findCycles(graph);

The result should be [['node1']]

If the graph was initialized without named edges

const graph = new graphlib.Graph({ multigraph: true });
graph.setNode('node1');
graph.setEdge('node1', 'node1', null);
const cycles = graphlib.alg.findCycles(graph);

The result is [['node1']]

Is there any reason why the self referencing cycles cannot be found when using named edges?