Skip to content

Commit

Permalink
Try to implement Tarjan iteration version
Browse files Browse the repository at this point in the history
use stack like topological sort to simulate recursion
use stack to contain components
still failed with some input data:
12
1 2
2 3
2 4
2 5
3 6
4 5
4 7
5 2
5 6
5 7
6 3
6 8
7 8
7 10
8 7
9 7
10 9
10 11
11 12
12 10
  • Loading branch information
Scott.L committed Aug 8, 2013
1 parent e1a48ef commit 7d99353
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion graph.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

while (!component.isEmpty() &&
(h=component.peek(), true) &&
(/*frontier.isEmpty() ||*/ low[h] === last[0] || low[h] === last[1])) {
(frontier.isEmpty() || low[h] === last[0] || low[h] === last[1])) {
c.push(component.pop());
last[0] = g.__labelAt__(h);
last[1] = low[h];
Expand Down

0 comments on commit 7d99353

Please sign in to comment.