-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.py
More file actions
55 lines (48 loc) · 1.25 KB
/
Copy pathtest.py
File metadata and controls
55 lines (48 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Build and analyse a small two-layer network."""
import numpy as np
import scipy.sparse as sp
from MuxVizPy import versatility
from MuxVizPy.utils import parsing
def main() -> None:
"""Build a supra-adjacency matrix and compute aggregated node degrees."""
num_nodes = 3
intra_networks = [
sp.csr_matrix(
np.array(
[
[0, 1, 0],
[0, 0, 1],
[0, 0, 0],
]
)
),
sp.csr_matrix(
np.array(
[
[0, 0, 1],
[0, 0, 0],
[0, 0, 0],
]
)
),
]
num_layers = len(intra_networks)
coupling = parsing.build_interlayer_coupling_matrix(
num_layers,
omega=1.0,
kind="categorical",
)
supra = parsing.build_supra_adjacency_matrix_from_edge_colored_matrices(
intra_networks,
coupling,
num_nodes,
)
degree = versatility.get_multi_degree(
supra,
nodes=num_nodes,
layers=num_layers,
)
print(f"nodes={num_nodes}, layers={num_layers}")
print(f"aggregated degree={degree.tolist()}")
if __name__ == "__main__":
main()