Graph density
Graph density is the proportion of possible edges between a graph’s nodes that are present.
Graph Neural Networks in Action
Graph density is the ratio of a graph's actual edges to the total number of possible edges.
- How it is used
- Uses density during structural exploratory data analysis to assess sparsity and identify potential blockers to graph neural network training.
- How deep it goes
- Defines the edge-to-possible-edge ratio and implements its calculation, but defers rigorous derivation and broader metric theory.
- Examples
- Uses a fraud network near density 0.00 and an Amazon Electronics co-purchaser graph with density 0.0049.
- What you can do after
- Diagnose graph sparsity with NetworkX or PyTorch adjacency data and relate the result to degree and component structure.
Read how Graph Neural Networks in Action explains graph density →
Knowledge Graphs and LLMs in Action
Graph density is the fraction of possible edges that are present between nodes in a graph or subgraph.
- How it is used
- Evaluates connectivity and completeness within disease pathways, clusters, knowledge graphs, and fraud-network egonets.
- How deep it goes
- Defines the metric, gives formulas, interprets distributions, and demonstrates Python calculation without deriving advanced graph theory.
- Examples
- Uses disease pathways in protein-interaction networks and node egonets in a fraud-detection graph, including tabulated node values.
- What you can do after
- Compute density for whole graphs, disease subgraphs, or node egonets and interpret high or low connectivity.
Read how Knowledge Graphs and LLMs in Action explains graph density →
Financial AI in Practice
Graph density is the proportion of possible edges that are present among a graph's nodes.
- How it is used
- Uses density to characterize Louvain-detected communities during investigation of potentially suspicious fraud groups.
- How deep it goes
- Defines density through community connectivity and identifies a value of one with a fully connected clique.
- Examples
- Calculates density for detected communities and compares it with their size and counts of users, IPs, devices, phones, and cards.
- What you can do after
- Evaluate communities by considering density alongside size and node-type counts when investigating potentially suspicious groups.
Related concepts
- graphmeasures · A graph is a mathematical structure consisting of vertices connected by edges that represent relationships or connections.
- communitymeasures · A graph community is a group of nodes that are more densely connected to one another than to nodes outside the group.
- ego networkuses · An ego network is a subgraph centered on a focal node that includes its immediate neighbors and the connections among them.
- disease pathwaymeasures · A disease pathway is a subgraph of a protein-protein interaction network containing proteins and interactions associated with a particular disease.
- sparse graphmeasures · A sparse graph is a graph with relatively few edges compared with the number of possible edges among its vertices.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


