You can create directed edges on undirected graphs which results in syntax errors in dot
drt24 opened this issue · comments
Daniel Thomas commented
Unless you call graph.SetDir(true)
then calling graph.AddEdge(parent, name, true, make(map[string]string))
will result in syntax errors like:
Error: <stdin>: syntax error in line 2 near '->'
This should be documented on AddEdge.
Walter Schulze commented
How would you propose to do that?
Daniel Thomas commented
// If directed is set to true then SetDir(true) must also be called or there will be a syntax error in the output.
It would also be possible to produce a warning/panic/error in AddEdge if directed && !this.Directed {
but that would change the API or be messy so documenting it is probably sufficient to avoid people making this mistake.
Walter Schulze commented
Sounds good :)
Walter Schulze commented