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 2⁢mn⁢n−1.
For a directed graph with n vertices and m arcs, the graph density is mn⁢n−1.
Note that self-loops are not included in the edge count for the purposes of computing graph density.
with⁡GraphTheory:
K4≔CompleteGraph⁡4
K4≔Graph 1: an undirected graph with 4 vertices and 6 edge(s)
GraphDensity⁡K4
1
H≔Digraph⁡Trail⁡1,2,3,1,4,3,Trail⁡4,2,1,3:
GraphDensity⁡H
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