mnets / pymnet

The original library for analyzing multilayer networks.
https://mnets.github.io/pymnet/
GNU General Public License v3.0
122 stars 24 forks source link

How to solve the degree and centrality of nodes and other indicators #10

Closed LINQcode1 closed 3 months ago

LINQcode1 commented 1 year ago

Hello May I ask how to call related packages to solve some related node indicators? For example, the degree and centrality of nodes, etc.

cloner174 commented 5 months ago

Can you be more detailed ? I am not sure what is your main concern. Are you trying to do some network analysis ?

ercco commented 3 months ago

Hi, I'm not entirely certain what "related packages" means in this context. To find e.g. degrees of node-layers, you can do:

>>> M = pymnet.MultilayerNetwork(aspects=1,fullyInterconnected=False)
>>> M[1,2,'a','b'] = 1
>>> M[2,2,'b','b'] = 1
>>> pymnet.degs(M,degstype='nodes')
{(1, 'a'): 1, (2, 'b'): 2}

Multilayer centrality depends on how you define it, so implementing a function for your application could be a good idea.