之前记录过基于R语言和Octave的多层网络可视化工具,但安装起来比较麻烦,发现Github上有基于Python的版本,提供了supra-adjency和多关系网络可视化,直接看:https://github.com/nkoub/multinetx
据说,安装比较简单:
pip install multinetx
我安装完了之后是这样的:
multinetx==1.0.dev0
然后美滋滋引用一下demo的代码:
##Import standard libraries
import numpy as np
import matplotlib.pyplot as plt
##Import the package MultiNetX
import multinetx as mx
##Create three Erd"os- R'enyi networks with N nodes for each layer
N = 50
g1 = mx.erdos_renyi_graph(N,0.07,seed=218)
g2 = mx.erdos_renyi_graph(N,0.07,seed=211)
g3 = mx.erdos_renyi_graph(N,0.07,seed=208)
##Define the type of interconnection between the layers
adj_block = mx.lil_matrix(np.zeros((N*3,N*3)))
adj_block[0: N, N:2*N] = np.identity(N)