public void ComputeScc() { var scc = new Scc <int>(); foreach (var i in scc.Compute(Graph).Take(5)) { Console.WriteLine(i); } }
public void ComputeSmall() { var g = new Graph <int>(); var v1 = g.GetOrCreateVertex(1); var v2 = g.GetOrCreateVertex(2); var v3 = g.GetOrCreateVertex(3); var v4 = g.GetOrCreateVertex(4); var v5 = g.GetOrCreateVertex(5); v1.Add(v2); v2.Add(v3); v3.Add(v1); v4.Add(v5); v5.Add(v4); var scc = new Scc <int>(); var a = scc.Compute(g).ToArray(); Assert.AreEqual(2, a.Length); Assert.AreEqual(3, a[0]); Assert.AreEqual(2, a[1]); }