/// <summary> /// Returns true when the given Vertex is reachable from the start Vertex inside the Graph. /// </summary> /// <param name="g"></param> /// <param name="start"></param> /// <param name="goal"></param> /// <returns></returns> public static bool IsVertexReachableFrom(Graph g, Vertex start, Vertex goal) { if (DijkstraSearch.Search(g, start, goal) != null) { return(true); } else { return(false); } }
/// <summary> /// Returns true when there is at least one path from each Vertex inside the Graph to every other Vertex. /// </summary> /// <param name="graph"></param> /// <returns></returns> public static bool IsGraphConnected(Graph g) { int c = DijkstraSearch.CountReachableNodes(g, g.Vertices[0]); return(c == g.Vertices.Length); }