GraphTheory - Maple Help

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/Diameter

GraphTheory

 Diameter

 Calling Sequence Diameter(G)

Parameters

 G - graph

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

 > 
 > 
 > 
 ${P}{:=}{\mathrm{Graph 1: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (1)
 > 
 ${2}$ (2)
 > 
 ${C}{:=}{\mathrm{Graph 2: an undirected unweighted graph with 19 vertices and 19 edge\left(s\right)}}$ (3)
 > 
 ${9}$ (4)
 > 
 ${G}{:=}{\mathrm{Graph 3: an undirected weighted graph with 4 vertices and 4 edge\left(s\right)}}$ (5)
 > 
 > 
 ${0.9}$ (6)

The distance between vertices 1 and 4 is maximal

 > 
 $\left[\left[{1}{,}{2}{,}{3}{,}{4}\right]{,}{0.9}\right]$ (7)