mirror of
https://github.com/gonum/gonum.git
synced 2025-10-08 16:40:06 +08:00
graph/encoding/dot: fix line visit marking
This commit is contained in:
@@ -220,7 +220,7 @@ func (p *simpleGraphPrinter) print(g graph.Graph, name string, needsIndent, isSu
|
||||
continue
|
||||
}
|
||||
p.visited[edge{inGraph: name, from: nid, to: tid}] = true
|
||||
p.visited[edge{inGraph: name, from: tid, to: n.ID()}] = true
|
||||
p.visited[edge{inGraph: name, from: tid, to: nid}] = true
|
||||
}
|
||||
|
||||
if !havePrintedEdgeHeader {
|
||||
@@ -432,6 +432,8 @@ type multiGraphPrinter struct {
|
||||
|
||||
type line struct {
|
||||
inGraph string
|
||||
from int64
|
||||
to int64
|
||||
id int64
|
||||
}
|
||||
|
||||
@@ -510,10 +512,18 @@ func (p *multiGraphPrinter) print(g graph.Multigraph, name string, needsIndent,
|
||||
|
||||
for _, l := range lines {
|
||||
lid := l.ID()
|
||||
if p.visited[line{inGraph: name, id: lid}] {
|
||||
continue
|
||||
if isDirected {
|
||||
if p.visited[line{inGraph: name, from: nid, to: tid, id: lid}] {
|
||||
continue
|
||||
}
|
||||
p.visited[line{inGraph: name, from: nid, to: tid, id: lid}] = true
|
||||
} else {
|
||||
if p.visited[line{inGraph: name, from: nid, to: tid, id: lid}] {
|
||||
continue
|
||||
}
|
||||
p.visited[line{inGraph: name, from: nid, to: tid, id: lid}] = true
|
||||
p.visited[line{inGraph: name, from: tid, to: nid, id: lid}] = true
|
||||
}
|
||||
p.visited[line{inGraph: name, id: lid}] = true
|
||||
|
||||
if !havePrintedEdgeHeader {
|
||||
p.buf.WriteByte('\n')
|
||||
|
Reference in New Issue
Block a user