GraphTheory
GraphDensity
compute graph density
Calling Sequence
Parameters
Description
Examples
Compatibility
GraphDensity(G)
G
-
graph
The GraphDensity(G) command returns the graph density of G.
For an undirected graph with n vertices and m edges, the graph density is 2mnn−1.
For a directed graph with n vertices and m arcs, the graph density is mnn−1.
Note that self-loops are not included in the edge count for the purposes of computing graph density.
withGraphTheory:
K4≔CompleteGraph4
K4≔Graph 1: an undirected graph with 4 vertices and 6 edge(s)
GraphDensityK4
1
H≔DigraphTrail1,2,3,1,4,3,Trail4,2,1,3:
GraphDensityH
23
The GraphTheory[GraphDensity] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
NumberOfEdges
Download Help Document