Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,14 @@ func (nc *negCyc) step5(F LabeledPath, fEnd NI) (ok bool) {
// new end node. make recursive call, then restore saved
// inbound arcs for the node.
F.Path[last] = h
nc.a[fEnd][0] = h
save := nc.cutTo(h.To)
ok = nc.all_nc(F)
nc.restore(save)
if !ok {
break
if len(nc.a[fEnd]) > 0 {
nc.a[fEnd][0] = h
save := nc.cutTo(h.To)
ok = nc.all_nc(F)
nc.restore(save)
if !ok {
break
}
}
}
// after loop, restore saved outgoing arcs in g.
Expand Down Expand Up @@ -685,9 +687,14 @@ func (nc *negCyc) restore(c []arc) {
r := c[i]
toList := nc.a[r.n]
last := len(toList)
toList = toList[:last+1]
toList[r.x], toList[last] = toList[last], toList[r.x]
nc.a[r.n] = toList
if last > 0 {
toList = toList[:last+1]
if r.x <= last {
toList[r.x], toList[last] = toList[last], toList[r.x]
nc.a[r.n] = toList
}

}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module "github.com/soniakeys/graph"
module "github.com/badasr/graph"

require "github.com/soniakeys/bits" v1.0.0