Graph Centrality Calculator
Which node in a network is the important one? There is no single answer, and that is the useful part. Degree counts neighbours, closeness measures how far everything else is, and betweenness counts how often a node sits on the shortest route between two others. They routinely disagree — the best-connected node is often not the one holding the network together — and seeing all three side by side is the quickest way to understand why.
What this generator does
Builds a connected network and computes three centrality measures for every node: degree from the edge list, closeness from the total hop distance to everywhere else, and betweenness with Brandes' algorithm. All three are then recomputed independently — degrees recounted, distances re-run by breadth-first search from every node — before display.
How to use this tool
- Choose a node count and an edge density.
- Guess which node is most important before generating.
- Read all three columns — the winners are often different nodes.
- Look for a node with low degree but high betweenness: that is a broker.
Understanding the controls
- How many nodes
- Between 4 and 12. Betweenness costs a search from every node, which stays instant at these sizes.
- Extra edge density (%)
- Sparse networks produce dramatic betweenness differences; dense ones flatten all three measures towards equality.
- Seed
- Any word reproduces the same network and the same scores.
Common use cases
- Teaching the three classic centrality measures on one worked network
- Showing that 'most connected' and 'most important' are different questions
- Worked examples for social-network analysis coursework
- Test instances for a centrality implementation
- Setting the same network twice from a seed
How this generator works
Brandes' algorithm computes betweenness in one pass per node: a breadth-first search counts how many shortest paths reach each node, then the dependencies are accumulated back down in reverse order. Where two shortest routes tie, the credit is split between them rather than given to either. The checks are deliberately independent — degrees are recounted from the edge list and every distance is re-derived — plus two structural facts that must hold: betweenness is never negative, and a leaf can never lie between two other nodes.
Randomness and fairness
The network is random; every score is computed and then recomputed independently. A seed reproduces the network exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Unweighted graphs — centrality on weighted networks uses path cost rather than hop count.
- Closeness is only meaningful on a connected graph, which is why the generator always produces one.
- Betweenness is shown unnormalised, so values are not comparable between different network sizes.
- Eigenvector and PageRank centrality are not included; these are the three that need no iteration to converge.
- Networks are not stored between visits; seed one you want again.
Privacy and your data
The network and its scores are computed entirely in your browser. Nothing about the graph or your seed is transmitted or kept.
Related generators
- Articulation Point GeneratorConnected graphs with their cut vertices found by depth-first search and confirmed by actually removing each node and counting the pieces.
- Graph Bridge FinderGraphs with their bridges identified — the edges that lie on no cycle — each one confirmed by deleting it and counting the pieces.
- Random Graph GeneratorRandom graphs at a density you choose, drawn and exported as an edge list or DOT, with connectivity measured rather than assumed.
- Shortest Path GeneratorWeighted graphs with Dijkstra's shortest route, verified by the relaxation condition rather than by trusting the code.