# The weights for the command "Graph.comunity\_edge\_betweenness()"

**URL:** <https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080>\
**Category:** Usage\
**Tags:** Python\
**Created:** [25 January 2022 07:11 UTC](https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080 "2022-01-25T07:11:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedram.jazayeri](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@pedram.jazayeri](https://igraph.discourse.group/u/pedram.jazayeri)\
**Post date:** [25 January 2022 07:11 UTC](https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080/1 "2022-01-25T07:11:17Z")

</div>

Hi everyone,  
I want to use the command “Graph.community\_edge\_betweenness()” in order to divide my network into sub networks. When I get the vertex weights by the command “Graph.edge\_betweenness()” and enter as weights in “Graph.community\_edge\_betweenness(weights=w)” for 2 clusters (condition1), there is not any differences in shown results with the results of condition that I do not enter weights(condition2) but, for 3 clusters, the shown clusters are different for both condition! So, first question is that how I can get the right weights for clusters more than 3 clusters and the second is that why these differences do appear?  
Thanks

---

<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:** [25 January 2022 07:34 UTC](https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080/2 "2022-01-25T07:34:59Z")

</div>

It is unclear what you mean. Can you show a [complete minimal example](http://sscce.org/) that illustrates your question?

---

<div class="post-metadata">

**Author:** ![pedram.jazayeri](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@pedram.jazayeri](https://igraph.discourse.group/u/pedram.jazayeri)\
**Post date:** [25 January 2022 07:50 UTC](https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080/3 "2022-01-25T07:50:52Z")

</div>

the first code is :  
import igraph  
g=igraph.Graph.Read(‘exp1.txt’, directed=False)  
d=g.community\_edge\_betweenness(clusters=3)  
p=d.as\_clustering()  
l=[(40,0), (10,10), (20,10), (30,10), (40,10), (50,10), (30,20), (40,20), (50,20), (30,30), (40,30)]  
igraph.plot(g,layout=l)

the second is :  
import igraph  
g=igraph.Graph.Read(‘exp1.txt’, directed=False)  
w=g.edge\_betwenness()  
d=g.community\_edge\_betweenness(clusters=3, weights=w)  
p=d.as\_clustering()  
l=[(40,0), (10,10), (20,10), (30,10), (40,10), (50,10), (30,20), (40,20), (50,20), (30,30), (40,30)]  
igraph.plot(g,layout=l)

But why there are differences between the shown communities(three clusters)?  
thanks

---

<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:** [25 January 2022 07:53 UTC](https://igraph.discourse.group/t/the-weights-for-the-command-graph-comunity-edge-betweenness/1080/4 "2022-01-25T07:53:19Z")

</div>

Can you make the example self-contained? We don’t have the data. Ideally, come up with a _minimal_ example that does not require an external data file.

Also, please format your post for readability (code should go in code blocks!)

> [@How to use this forum?](https://igraph.discourse.group/t/how-to-use-this-forum/35):
>
> If you are new to the Discourse platform, which we are using for this forum, the [Discourse New User Guide](https://meta.discourse.org/t/discourse-new-user-guide/96331) will show you the basics. In short, text is formatted using [Markdown](https://commonmark.org/help/) (recommended), BBCode or HTML. The examples below will help you get started. If you type \*\*Bold\*\*, \_italic\_, `print(str)` and a [link](http://igraph.org). it will format as Bold, italic, code and a [link](http://igraph.org). Program code can be delimited with triple backquotes. If you type ``` def sqr(x): y = x*x return y `…
