WienerIndex - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

GraphTheory

 WienerIndex
 find the Wiener index of a graph

 Calling Sequence WienerIndex(G)

Parameters

 G - graph

Description

 • WienerIndex returns the Wiener index of a graph G.
 • If G is disconnected, then WienerIndex returns infinity.

Definition

 • The Wiener index of a graph is the sum of the lengths of the shortest paths between all pairs of vertices in the graph.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $P≔\mathrm{PetersenGraph}\left(\right)$
 ${P}{≔}{\mathrm{Graph 1: an undirected graph with 10 vertices and 15 edge\left(s\right)}}$ (1)
 > $\mathrm{WienerIndex}\left(P\right)$
 ${30}$ (2)
 > $C≔\mathrm{CycleGraph}\left(19\right)$
 ${C}{≔}{\mathrm{Graph 2: an undirected graph with 19 vertices and 19 edge\left(s\right)}}$ (3)
 > $\mathrm{WienerIndex}\left(C\right)$
 ${38}$ (4)

Compatibility

 • The GraphTheory[WienerIndex] command was introduced in Maple 2024.
 • For more information on Maple 2024 changes, see Updates in Maple 2024.

 See Also