private static void TraversalSamplesTest() { TraversalSamples traversalSamples = new TraversalSamples(); //traversalSamples.AllPathsFromSourceToDestinationTest(); //traversalSamples.FWShortestPathTest(); //traversalSamples.DijkstraShortestPathTest(); //traversalSamples.IsConnectedByDfsIterativeTest(); }
public bool IsBiconnected(int[,] matrix, int source) { bool biConnected = false; if (TraversalSamples.IsConnectedBfsIterativeMatrix(matrix, source) && NoOfArticulationPoint(matrix, source) == 0) { biConnected = true; } return(biConnected); }
public bool HasCycleInDirected(Graph graph) { HashSet <Vertex> whiteSet = new HashSet <Vertex>(); HashSet <Vertex> graySet = new HashSet <Vertex>(); HashSet <Vertex> blackSet = new HashSet <Vertex>(); foreach (KeyValuePair <long, Vertex> vertexPair in graph.Verticies) { whiteSet.Add(vertexPair.Value); } foreach (var current in whiteSet) { if (TraversalSamples.DftRecursiveWGBList(current, whiteSet, graySet, blackSet)) { return(true); } } return(false); }