private void strongConnect(Graph g, Node n) { n.setIndexSCC(index); n.setLowlink(index); index++; s.Add(n); foreach (Arc a in g.getArcList()) { if (a.getOrigin() == n) { if (a.getEdge().getIndexSCC() == int.MaxValue) { strongConnect(g, a.getEdge()); n.setLowlink(Math.Min(n.getLowlink(), a.getEdge().getLowlink())); } else if(s.Contains(a.getEdge())) { n.setLowlink(Math.Min(n.getLowlink(), a.getEdge().getIndexSCC())); } } } if (n.getLowlink() == n.getIndexSCC()) { scc.Add(new List<Node>()); Node w = new Node(); do { w = s.Last(); s.Remove(s.Last()); scc.Last().Add(w); } while (n != w); } }