# density -- computes the density of a graph

## Synopsis

• Usage:
d = density G
• Inputs:
• G, an instance of the type Graph,
• Outputs:
• d, , the density of G

## Description

A dense graph has a high edge to vertex ratio, whereas a sparse graph has a low edge to vertex ratio. Density is equal to 2*|E| divided by |V|*(|V|-1). A complete graph has density 1; the minimal density of any graph is 0.

 i1 : G = graph({{1,2},{2,3},{3,4},{4,2},{1,4}},EntryMode=>"edges"); i2 : density G 5 o2 = - 6 o2 : QQ