Commit d81d8c3c authored by Michael Schwarz's avatar Michael Schwarz

fixed bug in circle display for order

A-->B-->C-->E-->A
	 \->D-/
parent 65de4205
Pipeline #114 skipped
...@@ -80,6 +80,8 @@ public abstract class GraphHelper<X> { ...@@ -80,6 +80,8 @@ public abstract class GraphHelper<X> {
private boolean strongConnect(X t){ private boolean strongConnect(X t){
TarjanNodeInfo node = tarjanNodeInfos.get(t); TarjanNodeInfo node = tarjanNodeInfos.get(t);
boolean reducedLowlink = false;
node.index = tarjanIndex; node.index = tarjanIndex;
node.lowlink = tarjanIndex; node.lowlink = tarjanIndex;
node.onStack = true; node.onStack = true;
...@@ -88,13 +90,25 @@ public abstract class GraphHelper<X> { ...@@ -88,13 +90,25 @@ public abstract class GraphHelper<X> {
for(X succ : edges.get(t)){ for(X succ : edges.get(t)){
if(tarjanNodeInfos.get(succ).index == -1){ if(tarjanNodeInfos.get(succ).index == -1){
if(strongConnect(succ)){ if(!reducedLowlink) {
return true; if(strongConnect(succ)){
return true;
}
int newLowlink = Math.min(node.lowlink,tarjanNodeInfos.get(succ).lowlink);
if(newLowlink < node.lowlink){
node.lowlink = newLowlink;
reducedLowlink = true;
}
} }
node.lowlink = Math.min(node.lowlink,tarjanNodeInfos.get(succ).lowlink);
} }
else if(tarjanNodeInfos.get(succ).onStack){ else if(tarjanNodeInfos.get(succ).onStack){
node.lowlink = Math.min(node.lowlink,tarjanNodeInfos.get(succ).index); int newLowlink = Math.min(node.lowlink,tarjanNodeInfos.get(succ).lowlink);
if(newLowlink < node.lowlink){
node.lowlink = newLowlink;
reducedLowlink = true;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment