The distance between two vertexSet is calculated as the number of edges in the shortest path between the two vertexSet. If the two vertexSet are not connected, the distance between them is infinity by convention.
i1 : G = graph({{1,2},{2,3},{3,4}},EntryMode=>"edges"); |
i2 : d = distance (G,1,4) o2 = 3 |
i3 : G = graph({1,2,3,4},{{2,3},{3,4}}); |
i4 : d = distance(G, 1, 4) o4 = infinity o4 : InfiniteNumber |
The object distance is a method function.