Skip to content

graph/encoding/dot: add multigraph serialization and deserialization support

Sebastien Binet requested to merge 32bitkid:multigraph-coding into master

Created by: 32bitkid

This should resolve issue #396, in the way that has been discussed there. This change introduces a new pair of MarshalMulti() and UnmarshalMulti() functions, both which take graph.Multigraph. Please take a look.

There are a couple outstanding questions on this particular implementation:

  • The arguments for Marshal() have remained unchanged. However, the new function MarshalMulti() does not include the strict argument, because it doesn't really make any sense in that context. But, I wonder if Marshal() should always emit a strict DOT graph, because thats what it really represents. However, that might be too big of a breaking change here.

  • In the multiprinter.print() function, I need to iterate lines, which I do via lines := graph.LinesOf(g.Lines(nid, tid)), I'm not sure if I need to explicitly sort the lines here to get a stable output, like one does a few lines up on NodesOf(), and if so, then what would be the preferred sorting strategy to use here?

If the approach looks worth moving forward, then I'll fill in some more testing coverage before finalizing the PR.

Thanks!

Merge request reports