Skip to content

Commit

Permalink
fix for jicksta#2
Browse files Browse the repository at this point in the history
  • Loading branch information
GrumpyOldTroll committed Mar 9, 2019
1 parent 94a7945 commit 81105d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func (builder *dagBuilder) addEdge(from, to string) error {
g, fromID, toID := builder.g, nodeIDFromName(from), nodeIDFromName(to)
fromNode, toNode := simple.Node(fromID), simple.Node(toID)

if !g.Has(fromID) {
if g.Node(fromID) == nil {
g.AddNode(fromNode)
(*builder.nodeNames)[fromID] = from
}

if !g.Has(toID) {
if g.Node(toID) == nil {
g.AddNode(toNode)
(*builder.nodeNames)[toID] = to
}
Expand All @@ -48,7 +48,7 @@ func (builder *dagBuilder) addEdge(from, to string) error {
}

if _, err := topo.Sort(g); err != nil {
g.RemoveEdge(newEdge)
g.RemoveEdge(fromID, toID)
return err
}

Expand Down Expand Up @@ -76,7 +76,7 @@ func (builder *dagBuilder) tsort() []string {

// graphViz returns a DOT-format "encoding" of the DAG for visualizing with GraphViz
func (builder *dagBuilder) graphViz() string {
out, _ := dot.Marshal(builder.g, "Election", "", " ", false)
out, _ := dot.Marshal(builder.g, "Election", "", " ")
return string(out)
}

Expand Down

0 comments on commit 81105d3

Please sign in to comment.