public bool Connected(N i, N j) { if (i == null || j == null) { throw new ArgumentNullException(); } if (!id.Contains(i) || !id.Contains(j)) { throw new ArgumentException(); } return(Root(i).Equals(Root(j))); }
/// <summary> /// Returns true if there is a path from the source vertex to <code>v</code>, false otherwise. /// </summary> public bool Contains(Vertex vertex) => vertex.Equals(Source) || edgeTo.Contains(vertex);