Advanced maths

Graph centrality calculator from adjacency matrix

Compare normalized degree, incoming closeness, shortest-path betweenness and PageRank on one unweighted directed or undirected graph.

Your numbers

Order 1–40, zero diagonal. A row-to-column 1 means an outgoing directed edge. Undirected mode requires symmetry.
Uniform teleportation and dangling-node redistribution. Only PageRank depends on this value.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Centrality scores describe different structural roles for a vertex. Degree measures immediate connections, closeness summarizes incoming shortest-path distance, betweenness counts how often a vertex lies inside shortest routes and PageRank distributes probability through outgoing edges with teleportation. This calculator presents all four on the same vertex table so their conventions remain comparable. It uses unit edge lengths, normalized Brandes betweenness, disconnected-graph closeness scaling and an explicitly converged PageRank iteration. No one score is labeled a universal measure of importance.

THE FORMULADegree: degree/(n−1); closeness uses incoming reachable distances; betweenness shares shortest-path credit; PageRank solves a damped transition fixed point.

A worked example

For undirected path 1–2–3, normalized degrees are 0.5,1,0.5. Incoming closeness values are 2/3,1,2/3, because the middle vertex is one step from both others. Betweenness is 0,1,0: the only endpoint-to-endpoint route passes through vertex two. With damping 0.85, PageRank is approximately 0.256757,0.486486,0.256757. The probability scores add to one. They are not equal to degree normalization because teleportation changes the random-walk balance.

Good to know

Unweighted simple zero-diagonal 0/1 matrices of order 1–40. Undirected input must be symmetric. Directed degree combines in-degree and out-degree over n−1 and can exceed one; directed closeness uses incoming paths. Unreachable sources lower closeness through Wasserman–Faust scaling. PageRank uses uniform personalization and dangling-node redistribution, with L1 iterate change below 10⁻¹² and at most 10,000 iterations. An unconverged run raises an error. Edge weights, personalized teleportation, causal influence and uncertainty about missing edges are not modeled.

Different scores reward different kinds of position

A vertex with many immediate neighbors has high degree even when those neighbors sit in a remote part of the network. A vertex on short routes between regions can have substantial betweenness without the highest degree. Closeness instead favors short distances from the relevant reachable sources. These distinctions are mathematical consequences of the definitions; disagreement between columns is not necessarily a software error or evidence that one metric should be discarded.

Directed orientation changes the question. An adjacency entry in row u and column v permits travel from u to v. The closeness convention here considers routes arriving at the scored vertex, while PageRank follows outgoing transitions before redistributing probability. Reversing every edge can therefore change these columns. The combined directed-degree normalization can exceed one because a vertex can have both an incoming and outgoing edge for each other vertex.

The middle vertex of a three-vertex path mediates its endpoint routes123Degree 0.5Degree 1Degree 0.5Betweenness: 0, 1, 0Closeness: 2/3, 1, 2/3
Normalized degree is (0.5,1,0.5), closeness is (2/3,1,2/3) and betweenness is (0,1,0). PageRank at damping 0.85 is approximately (0.256757,0.486486,0.256757).

Disconnectedness and damping must remain visible

Closeness calculated only within a tiny reachable set can misleadingly make an isolated corner look globally central. Wasserman–Faust scaling reduces the score by the reachable fraction of the other vertices. A vertex reached by nobody receives zero. Betweenness excludes the route endpoints and divides tied shortest-path credit, rather than arbitrarily choosing one route and assigning its whole contribution to that path’s interior vertices.

PageRank remains defined when a vertex has no outgoing edges because its probability is redistributed uniformly. Teleportation supplies the remaining uniform mass on every iteration, and changing damping alters the balance between graph following and teleporting. The reported score sum and iteration residual help check the result but do not prove that this graph faithfully represents a real social or information system. The Graph radius diameter and center calculator from an adjacency matrix instead focuses on worst-case distances, which answer a different central-location question.

A few questions, answered

Which centrality score is the correct one?

That depends on the structural question. Immediate degree, typical incoming distance, shortest-route mediation and random-walk probability measure different roles.

Why is singleton degree zero here?

The usual degree denominator n−1 vanishes for one vertex. This page explicitly defines its singleton normalized degree and closeness as zero, while PageRank is one.

Find your calculator

Start typing to explore the library.