# Documentation of the algorithm of eigen\_centrality

**URL:** <https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879>\
**Category:** Usage\
**Tags:** R\
**Created:** [1 October 2021 11:08 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879 "2021-10-01T11:08:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natalie\_Burford](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/natalie_burford/32/584_2.png) [@Natalie\_Burford](https://igraph.discourse.group/u/Natalie_Burford)\
**Post date:** [1 October 2021 11:08 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/1 "2021-10-01T11:08:25Z")

</div>

Hi, I would like to use eigen\_centrality in R with a weighed network, setting weights = TRUE. Which formula / algorithm does eigen\_centrality use? Is there a reference paper? I couldn’t find the exact documentation for weighted networks. Thank you! Natalie

---

<div class="post-metadata">

**Author:** ![jboynyc](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/jboynyc/32/240_2.png) [@jboynyc](https://igraph.discourse.group/u/jboynyc)\
**Post date:** [1 October 2021 11:47 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/2 "2021-10-01T11:47:48Z")

</div>

~~This discussion might be helpful: [Help seeking on calculating betweenness centrality with valued ties](https://igraph.discourse.group/t/help-seeking-on-calculating-betweenness-centrality-with-valued-ties/280/1)~~

Never mind, I misread your question and thought you were asking about betweenness centrality.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [1 October 2021 13:46 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/3 "2021-10-01T13:46:48Z")

</div>

Eigenvector centrality is just the leading eigenvector of the adjacency matrix (i.e. one value for each vertex). To learn more about it, I recommend Newman’s book,

[https://oxford.universitypressscholarship.com/view/10.1093/acprof:oso/9780199206650.001.0001/acprof-9780199206650](https://oxford.universitypressscholarship.com/view/10.1093/acprof:oso/9780199206650.001.0001/acprof-9780199206650)

There are some subtleties to defining eigenvector centrality, or rather the definition of the _adjacency matrix_, and the documentation of some software packages are not entirely precise. We tried to give a full description in the documentation of igraph’s C core, which you find here:

[https://igraph.org/c/doc/igraph-Structural.html#igraph\_eigenvector\_centrality](https://igraph.org/c/doc/igraph-Structural.html#igraph_eigenvector_centrality)

Please read it in detail.

In particular, pay attention to the handling of non-simple graphs:

- In the adjacency matrix, A\_{ij} is the number of connections between vertices i and j if i \neq j. Some other software ignores multi-edges.
- A\_{ii} denotes _twice_ the number of self-loops in _undirected_ graphs. Some other software uses it once, or uses just 1 in all cases.

When the graph is weighted, the adjacency matrix elements are the edge weights. Weights of parallel edges are added up. Weights of self-loops are multiplied by two in undirected graphs.

The current release of R/igraph may not yet have caught up with the definition I describe above, but the next release will follow it precisely. If you are working with simple graphs (i.e. no self-loops, no multi-edges) then there isn’t anything to pay special attention to.

* * *

> [@Natalie\_Burford](#):
>
> Which formula / algorithm does eigen\_centrality use?

As for the algorithm, the eigenproblem is solved with the ARPACK library.

This is more efficient than the naive iterative algorithm ([power iteration](https://en.wikipedia.org/wiki/Power_iteration)) that you’ll find e.g. in Newman’s book.

---

<div class="post-metadata">

**Author:** ![ErwinFT](https://avatars.discourse-cdn.com/v4/letter/e/3da27b/32.png) [@ErwinFT](https://igraph.discourse.group/u/ErwinFT)\
**Post date:** [20 December 2021 14:20 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/4 "2021-12-20T14:20:24Z")

</div>

How does igraph incorporate weights into the computation of eigenvector centrality?  
Is it as “simple” as taking matrix A to be the weighted matrix instead of the Adjacency matrix?  
I haven’t been able to find a detailed explanation of it.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [20 December 2021 15:15 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/5 "2021-12-20T15:15:03Z")

</div>

> [@ErwinFT](#):
>
> Is it as “simple” as taking matrix A to be the weighted matrix instead of the Adjacency matrix?

Yes, that’s what it does.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [20 December 2021 15:31 UTC](https://igraph.discourse.group/t/documentation-of-the-algorithm-of-eigen-centrality/879/6 "2021-12-20T15:31:24Z")

</div>

I clarified the docs a bit. Hopefully this will propagate up to the docs of high-level interfaces.

> <https://github.com/igraph/igraph/commit/d243f0bf47dcd51fb8afc09368442679b895a11f>
