mirror of
https://github.com/gonum/gonum.git
synced 2025-10-19 05:24:52 +08:00
encoding/dot: set DOT node ID before adding node to graph (#775)
This makes it possible to implement the AddNode method of graph.NodeAdder to track the nodes of a graph by DOT node ID, as they are added.
This commit is contained in:
@@ -153,10 +153,10 @@ func (gen *generator) node(dst graph.NodeAdder, id string) graph.Node {
|
||||
return n
|
||||
}
|
||||
n := dst.NewNode()
|
||||
dst.AddNode(n)
|
||||
if n, ok := n.(DOTIDSetter); ok {
|
||||
n.SetDOTID(id)
|
||||
}
|
||||
dst.AddNode(n)
|
||||
gen.ids[id] = n
|
||||
// Check if within the context of a subgraph, that is to be used as a vertex
|
||||
// of an edge.
|
||||
|
Reference in New Issue
Block a user