mirror of
https://github.com/gonum/gonum.git
synced 2025-10-19 21:44:41 +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
|
return n
|
||||||
}
|
}
|
||||||
n := dst.NewNode()
|
n := dst.NewNode()
|
||||||
dst.AddNode(n)
|
|
||||||
if n, ok := n.(DOTIDSetter); ok {
|
if n, ok := n.(DOTIDSetter); ok {
|
||||||
n.SetDOTID(id)
|
n.SetDOTID(id)
|
||||||
}
|
}
|
||||||
|
dst.AddNode(n)
|
||||||
gen.ids[id] = n
|
gen.ids[id] = n
|
||||||
// Check if within the context of a subgraph, that is to be used as a vertex
|
// Check if within the context of a subgraph, that is to be used as a vertex
|
||||||
// of an edge.
|
// of an edge.
|
||||||
|
Reference in New Issue
Block a user