From d73c925d3d9e217b334b71c9d92eaaf82739d205 Mon Sep 17 00:00:00 2001 From: badasr <48412637+badasr@users.noreply.github.com> Date: Wed, 27 Mar 2019 17:02:41 +0800 Subject: [PATCH 1/3] fix panic: runtime error caused by restore() --- dir.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dir.go b/dir.go index a9ce535..d2366da 100644 --- a/dir.go +++ b/dir.go @@ -685,9 +685,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 + } + + } } } From 9b55ba26fded4cda81a45d7907a94d305048b4b8 Mon Sep 17 00:00:00 2001 From: badasr <48412637+badasr@users.noreply.github.com> Date: Wed, 24 Apr 2019 10:02:13 +0800 Subject: [PATCH 2/3] Update dir.go --- dir.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dir.go b/dir.go index d2366da..1c140c7 100644 --- a/dir.go +++ b/dir.go @@ -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. From 9209eaabef5c064eba2c2ee8ee8d3f5f2b71ee76 Mon Sep 17 00:00:00 2001 From: badasr <48412637+badasr@users.noreply.github.com> Date: Wed, 15 Apr 2020 09:41:19 +0800 Subject: [PATCH 3/3] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 67bf8e0..3da6891 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module "github.com/soniakeys/graph" +module "github.com/badasr/graph" require "github.com/soniakeys/bits" v1.0.0