Skip to content

GraphDiameter ​

The greatest eccentricity among all vertices of a Graph.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageGraphDiameter✓
GraphDiameter(g)max over v of VertexEccentricity(g, v); PositiveInfinity if g is disconnected.
Typed signatures
TypePackageApplies
(value) -> real | signed_infinitycombinatoricsalways

Domain: Collections

Examples

Basic #
live ↗
InGraphDiameter(Graph([1,2,3,4,5],[UndirectedEdge(1,2),UndirectedEdge(2,3),UndirectedEdge(3,4),UndirectedEdge(4,5)]))\mathrm{GraphDiameter}(\mathrm{Graph}(\bigl\lbrack1, 2, 3, 4, 5\bigr\rbrack, \bigl\lbrack\mathrm{UndirectedEdge}(1, 2), \mathrm{UndirectedEdge}(2, 3), \mathrm{UndirectedEdge}(3, 4), \mathrm{UndirectedEdge}(4, 5)\bigr\rbrack))Out44
live ↗
InGraphDiameter(Graph([1,2,3,4],[UndirectedEdge(1,2),UndirectedEdge(3,4)]))\mathrm{GraphDiameter}(\mathrm{Graph}(\bigl\lbrack1, 2, 3, 4\bigr\rbrack, \bigl\lbrack\mathrm{UndirectedEdge}(1, 2), \mathrm{UndirectedEdge}(3, 4)\bigr\rbrack))Out∞∞
About
Examples2
Checked againstWolfram Language 2 agree
CrosswalkWolfram Language

See also: GraphRadius, GraphPeriphery, VertexEccentricity