# Assortativity coeficient in network analysis

**URL:** <https://discourse.julialang.org/t/assortativity-coeficient-in-network-analysis/68425>\
**Category:** Statistics\
**Tags:** network-analysis\
**Created:** [September 19, 2021, 9:30pm UTC](https://discourse.julialang.org/t/assortativity-coeficient-in-network-analysis/68425 "2021-09-19T21:30:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emchateau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/emchateau/32/28597_2.png) [@emchateau](https://discourse.julialang.org/u/emchateau)\
**Post date:** [September 19, 2021, 9:30pm UTC](https://discourse.julialang.org/t/assortativity-coeficient-in-network-analysis/68425/1 "2021-09-19T21:30:26Z")

</div>

Hi,

For a network analysis, we are looking to calculate an assortativity coefficient or assortative mixing coefficient of a graph to state the homophily between two categories of nodes.

LightGraphs have [a `assortativity` function](https://juliagraphs.org/LightGraphs.jl/latest/community/#LightGraphs.assortativity-Union%7BTuple%7BAbstractGraph%7BT%7D%7D,%20Tuple%7BT%7D%7D%20where%20T) but as far we understand, it doesn’t seems to deal with node categories.

Is there any way to calculate the assortativity coefficient between two collections of vertices like with iGraph in R ? cf. [igraph R manual pages](https://igraph.org/r/doc/assortativity.html)

Références : Newman, M. E. J. 2003. « Mixing patterns in networks ». _Physical Review E_ 67 (2) : 026126. [Phys. Rev. E 67, 026126 (2003) - Mixing patterns in networks](https://doi.org/10.1103/PhysRevE.67.026126).

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [September 19, 2021, 11:50pm UTC](https://discourse.julialang.org/t/assortativity-coeficient-in-network-analysis/68425/2 "2021-09-19T23:50:12Z")

</div>

Have you checked [Assortativity.jl](https://github.com/lpmdiaz/Assortativity.jl)?

---

<div class="post-metadata">

**Author:** ![emchateau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/emchateau/32/28597_2.png) [@emchateau](https://discourse.julialang.org/u/emchateau)\
**Post date:** [September 21, 2021, 12:48pm UTC](https://discourse.julialang.org/t/assortativity-coeficient-in-network-analysis/68425/3 "2021-09-21T12:48:22Z")

</div>

Thanks a lot. But it seems this function is dedicated to inferred network associativity.  
We found these discussions (currently going throught them) :

- [https://github.com/JuliaGraphs/LightGraphs.jl/issues/272](https://github.com/JuliaGraphs/LightGraphs.jl/issues/272)
- [https://github.com/JuliaGraphs/LightGraphs.jl/pull/275](https://github.com/JuliaGraphs/LightGraphs.jl/pull/275)
- [https://github.com/JuliaGraphs/LightGraphs.jl/issues/1508](https://github.com/JuliaGraphs/LightGraphs.jl/issues/1508)
