GraphTheory[Diameter] - Maple Help

Online Help

All Products    Maple    MapleSim


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

withGraphTheory:

withSpecialGraphs:

P:=PetersenGraph:

DiameterP

2

(1)

C:=CycleGraph19:

DiameterC

9

(2)

G:=Graph1,2,0.2,2,3,0.3,3,4,0.4,4,1,1.1

G:=Graph 3: an undirected weighted graph with 4 vertices and 4 edge(s)

(3)

DrawGraphG

DiameterG

0.9

(4)

The distance between vertices 1 and 4 is maximal

DijkstrasAlgorithmG,1,4

1,2,3,4,0.9

(5)

See Also

AllPairsDistance, DijkstrasAlgorithm, Distance, ShortestPath


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam