mnets / pymnet

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

pymnet: A Python Library for Multilayer Networks

codecov DOI

pymnet is a Python package for creating, analyzing, and visualizing multilayer networks as formalized by Kivelä et al. (2014). It is designed for network scientists with an easy-to-use yet flexible interface, featuring, inter alia, representations of a very general class of multilayer networks, structural metrics of multilayer networks, and random multilayer-network models.

To learn more about the concepts and design principles underlying pymnet, check out this overview.

Features

Working with pymnet

Installation

We recommend executing the following command in a virtual environment:

$ python -m pip install pymnet

Usage

To get started with pymnet, check out our tutorials –– and when in doubt, consult the API reference contained in our documentation.

As an introductory example, with the following code, we can create a small multiplex network capturing different types of social relations between individuals and visualize the result:

import pymnet

net_social = pymnet.MultiplexNetwork(couplings="categorical", fullyInterconnected=False)
net_social["Alice", "Bob", "Friends"] = 1
net_social["Alice", "Carol", "Friends"] = 1
net_social["Bob", "Carol", "Friends"] = 1
net_social["Alice", "Bob", "Married"] = 1

fig_social = pymnet.draw(net_social, layout="circular", layerPadding=0.2, defaultLayerLabelLoc=(0.9,0.9))

An image of a small multiplex social network.

Contributing

We welcome contributions! Before you get started, please check out our contribution guide.

Asking Questions