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

# Online Help

###### All Products    Maple    MapleSim

GraphTheory

 GraphDensity
 compute graph density

 Calling Sequence GraphDensity(G)

Parameters

 G - graph

Description

 • The GraphDensity(G) command returns the graph density of G.
 • For an undirected graph with n vertices and m edges, the graph density is $\frac{2m}{n\left(n-1\right)}$.
 • For a directed graph with n vertices and m arcs, the graph density is $\frac{m}{n\left(n-1\right)}$.
 • Note that self-loops are not included in the edge count for the purposes of computing graph density.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{K4}≔\mathrm{CompleteGraph}\left(4\right)$
 ${\mathrm{K4}}{≔}{\mathrm{Graph 1: an undirected graph with 4 vertices and 6 edge\left(s\right)}}$ (1)
 > $\mathrm{GraphDensity}\left(\mathrm{K4}\right)$
 ${1}$ (2)
 > $H≔\mathrm{Digraph}\left(\mathrm{Trail}\left(1,2,3,1,4,3\right),\mathrm{Trail}\left(4,2,1,3\right)\right):$
 > $\mathrm{GraphDensity}\left(H\right)$
 $\frac{{2}}{{3}}$ (3)

Compatibility

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

 See Also