public void ComputeCriticalPath(IVertexListGraph<string, Edge<string>> g) { // is this a dag ? bool isDag = AlgoUtility.IsDirectedAcyclicGraph(g); var relaxer = new CriticalDistanceRelaxer(); var vertices = new List<string>(g.Vertices); foreach (string root in vertices) { if (isDag) Search(g, root, relaxer); else { try { Search(g, root, relaxer); Assert.Fail("should have found the acyclic graph"); } catch (NonAcyclicGraphException) { Console.WriteLine("NonAcyclicGraphException caught (as expected)"); } } } }
public void ComputeCriticalPath(IVertexListGraph <string, Edge <string> > g) { // is this a dag ? bool isDag = AlgoUtility.IsDirectedAcyclicGraph(g); var relaxer = new CriticalDistanceRelaxer(); var vertices = new List <string>(g.Vertices); foreach (string root in vertices) { if (isDag) { Search(g, root, relaxer); } else { try { Search(g, root, relaxer); Assert.Fail("should have found the acyclic graph"); } catch (NonAcyclicGraphException) { Console.WriteLine("NonAcyclicGraphException caught (as expected)"); } } } }