OriginChainDB docs
examples · graph · 13 / 17

13. eigenvector_centrality - influence by association

← Graph examples

what this does

eigenvector_centrality scores a node by the scores of the nodes attached to it, so being pointed at by three important nodes counts for more than being pointed at by thirty unimportant ones. GET /v1/tenants/:t/graph/:schema/eigenvector_centrality runs power iteration over the relation and returns one row per node, sorted descending. Unlike pagerank, it needs no node universe: it scores whatever is in the table.

when to use it

  • Ranking influence across a whole table without having to choose the candidate set first, which is what pagerank makes you do.
  • Prestige-style scoring, where an endorsement from an already-central node should count for more than one from the periphery.
  • A cheap global ranking used to seed a more expensive per-candidate model.

schema requirement

The relation must be declared in the schema's [[relations]] block and must target the table it is declared on. See schemas/reference#relations.

the request

rel is required. max_iter (default 50) bounds the power iteration and tol (default 1e-6) is the convergence threshold. max_iter=0 is refused with a 400.

GET /v1/tenants/:t/graph/:schema/eigenvector_centrality?rel=...
curl -G "https://$OC_HOST/v1/tenants/$OC_TENANT/graph/social.users/eigenvector_centrality" \
  --data-urlencode "rel=follows" \
  --data-urlencode "max_iter=50" \
  --data-urlencode "tol=1e-6" \
  -H "Authorization: Bearer $OC_TOKEN"

what you get back

[
  { "pk": ["dave"],    "eigenvector": 0.51 },
  { "pk": ["carol"],   "eigenvector": 0.44 },
  { "pk": ["bob"],     "eigenvector": 0.36 },
  { "pk": ["alice"],   "eigenvector": 0.29 },
  { "pk": ["mallory"], "eigenvector": 0.0 }
]

One row per node, sorted by score descending. pk is the primary-key array and the score field is named eigenvector. The score field name differs on every centrality endpoint - betweenness returns betweenness and pagerank returns score - so a shared parser has to know which endpoint produced the body it is holding.

how it works

  • Power iteration: start from a uniform vector, multiply repeatedly by the adjacency matrix, renormalise, and stop when the change falls below tol or after max_iter rounds.
  • The iteration runs on the adjacency matrix plus the identity rather than the adjacency matrix alone. That shift is what stops a bipartite graph oscillating between two states and never converging.
  • Scores are relative, not absolute. Only the ordering and the ratios between scores carry meaning.
  • No node universe is required, which is the practical difference from pagerank: pagerank makes you name the subgraph up front, this endpoint scores the table as it stands.

common mistakes

  • Expecting pagerank's numbers. Eigenvector centrality has no damping factor and no random-restart term, so it concentrates far more weight on the densest region of the graph. The two rankings will differ and neither is wrong.
  • Reading a zero as a bug. A node with no inbound edges receives no weight. Isolated rows legitimately score zero.
  • Reusing a betweenness parser. The score field is called eigenvector here, and reading row.betweenness gives you nothing.