GraphDensity [g]
gives the graph density of the graph g.
GraphDensity [{vw,…}]
uses rules vw to specify the graph g.
GraphDensity
GraphDensity [g]
gives the graph density of the graph g.
GraphDensity [{vw,…}]
uses rules vw to specify the graph g.
Details and Options
- GraphDensity is the ratio of the number of edges divided by the number of edges of a complete graph with the same number of vertices.
- A simple undirected graph with vertices and edges has graph density .
- A simple directed graph with vertices and edges has graph density .
Examples
open all close allBasic Examples (2)
Compute the density of a graph:
Graph density distribution of the Bernoulli graph model:
Scope (6)
GraphDensity works with undirected graphs:
Directed graphs:
Multigraphs:
Mixed graphs:
Use rules to specify the graph:
GraphDensity works with large graphs:
Applications (4)
Find the proportion of games between teams during an American college football season:
Compute the probability that two randomly chosen friends in a network are connected:
Model a social network:
Simulate the model:
Analyze the model:
The expected number of edges matches the original graph:
Distribution of density in BernoulliGraphDistribution [n,p]:
The expected value is p:
Properties & Relations (6)
GraphDensity measures the density of the AdjacencyMatrix :
Get the density from AdjacencyMatrix :
The graph density is between 0 and 1:
The density of an empty graph is 0:
Use EmptyGraphQ to test for emptiness:
The density of a complete graph is 1:
Use CompleteGraphQ to test for complete graphs:
Converting an undirected graph to a directed graph does not change the density:
Unless self-loops are taken into consideration:
LocalClusteringCoefficient gives a local measure of density:
See Also
Related Guides
Text
Wolfram Research (2012), GraphDensity, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphDensity.html (updated 2015).
CMS
Wolfram Language. 2012. "GraphDensity." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/GraphDensity.html.
APA
Wolfram Language. (2012). GraphDensity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphDensity.html
BibTeX
@misc{reference.wolfram_2025_graphdensity, author="Wolfram Research", title="{GraphDensity}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/GraphDensity.html}", note=[Accessed: 12-December-2025]}
BibLaTeX
@online{reference.wolfram_2025_graphdensity, organization={Wolfram Research}, title={GraphDensity}, year={2015}, url={https://reference.wolfram.com/language/ref/GraphDensity.html}, note=[Accessed: 12-December-2025]}