glejeune/node-graphviz

Is there a way to tell this library to ignore duplicate edges?

Closed this issue · 3 comments

I have some code which ends up creating duplicate edges because I can't figure out how to check if an exact same edge already exists.

Is there a way by which I can tell this library to simply ignore duplicate edges?

To demonstrate the issue, I am attaching this output image:

output image

Its not hard to do book-keeping of what edges are already set, but it would dirty down the client code.
It would be awesome if the library could do book-keeping and either expose methods to query edges OR just simply provide an option to ignore duplicate edges.

I'm not familiar with this library, but the underlying graphviz app allows a keyword "strict" that allows at most one edge between any two nodes (in each direction). The keyword goes before "digraph", so it's "strict digraph { ... }" If node-graphviz doesn't have "strict", it's probably easy to add, since it must be generating graphviz source at some point.

How to make graph strict ?