GraphTheory[Diameter]
|
Calling Sequence
|
|
Diameter(G)
|
|
Description
|
|
•
|
Diameter returns the maximum distance among all pairs of vertices in the graph G. If G is disconnected then the output is infinity.
|
•
|
For weighted graphs the edge weights are used to denote the distance accrued while traveling along each edge. For unweighted graphs the length of each edge is assumed to be 1.
|
•
|
The strategy is to use the Floyd-Warshall all-pairs shortest path algorithm.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
>
|
|
| (4) |
The distance between vertices 1 and 4 is maximal
>
|
|
| (5) |
|
|
Download Help Document
Was this information helpful?