# cluster\_leading\_eigen and cluster\_edge\_betweenness functions

**URL:** <https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201>\
**Category:** Usage\
**Tags:** R\
**Created:** [27 April 2022 08:18 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201 "2022-04-27T08:18:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilhom\_Sadriddinov](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/ilhom_sadriddinov/32/720_2.png) [@Ilhom\_Sadriddinov](https://igraph.discourse.group/u/Ilhom_Sadriddinov)\
**Post date:** [27 April 2022 08:18 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/1 "2022-04-27T08:18:31Z")

</div>

Hi, I have been working on community detection so far.  
My purpose is to apply betweenness centrality and eigenvector centrality.  
However, when I applied cluster\_edge\_betweenness and cluster\_leading\_eigen function they produced the same result. Even membership vectors are also identical. Then I suspected that I used functions wrongly, but when I tried with the “karate” dataset it worked well. Two functions generated different results. Could anyone explain why while I am passing my data to these functions, they are giving the same result?. Here is my data and source code:  
[adj\_mat\_users.csv](https://igraph.discourse.group/uploads/short-url/6y8BwNuFK4npLfwSmzX65h8GbUh.csv) (1.1 MB)

```auto
train_network <- graph_from_adjacency_matrix(adj_mat_users,
                                             mode = "undirected",
                                             weighted = NULL,
                                             diag = FALSE)

train_community_eigen <- cluster_leading_eigen(train_network)
train_community_edge <- cluster_edge_betweenness(train_network)

```

---

<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:** [27 April 2022 08:36 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/2 "2022-04-27T08:36:06Z")

</div>

> [@Ilhom\_Sadriddinov](#):
>
> Could anyone explain why while I am passing my data to these functions, they are giving the same result?.

Why do you think they shouldn’t?

> [@Ilhom\_Sadriddinov](#):
>
> My purpose is to apply betweenness centrality and eigenvector centrality.

`cluster_leading_eigen()` does not use eigenvector centrality. I recommend reading up on how these methods work if you intend to depend on their details.

---

<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:** [27 April 2022 08:43 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/3 "2022-04-27T08:43:35Z")

</div>

I’ll note that I downloaded your graph and all of its connected components are cliques.

---

<div class="post-metadata">

**Author:** ![Ilhom\_Sadriddinov](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/ilhom_sadriddinov/32/720_2.png) [@Ilhom\_Sadriddinov](https://igraph.discourse.group/u/Ilhom_Sadriddinov)\
**Post date:** [27 April 2022 08:43 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/4 "2022-04-27T08:43:55Z")

</div>

> [@szhorvat](#):
>
> `cluster_leading_eigen()` does not use eigenvector centrality. I recommend reading up on how these methods work if you intend to depend on their details.

Does it use the leading eigenvector method?  
I wanted to ask about the calculation of cluster\_leading\_eigen().  
Is it possible to compute and construct communities without using this function? I mean by using other intermediate functions provided by igraph?

---

<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:** [27 April 2022 08:48 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/5 "2022-04-27T08:48:45Z")

</div>

> [@Ilhom\_Sadriddinov](#):
>
> Does it use the leading eigenvector method?

You can check the documentation, which has a reference to the paper describing the method: [igraph R manual pages](https://igraph.org/r/doc/cluster_leading_eigen.html)

> [@Ilhom\_Sadriddinov](#):
>
> Is it possible to compute and construct communities without using this function? I mean by using other intermediate functions provided by igraph?

I am not sure what you mean. There are several community detection functions provided by igraph. However, it makes no sense to do community detection on your graph, since it consists of disconnected cliques.

---

<div class="post-metadata">

**Author:** ![Ilhom\_Sadriddinov](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/ilhom_sadriddinov/32/720_2.png) [@Ilhom\_Sadriddinov](https://igraph.discourse.group/u/Ilhom_Sadriddinov)\
**Post date:** [27 April 2022 08:50 UTC](https://igraph.discourse.group/t/cluster-leading-eigen-and-cluster-edge-betweenness-functions/1201/6 "2022-04-27T08:50:03Z")

</div>

> [@szhorvat](#):
>
> components

Yes, each of them is a complete sub-graph, by the way.
