awalterschulze / gographviz

Parses the Graphviz DOT language in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

You can create directed edges on undirected graphs which results in syntax errors in dot

drt24 opened this issue · comments

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.

How would you propose to do that?

// 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.

Sounds good :)