Multiplex Network Analysis
Multiplex networks have the same nodes across different layers, enabling specialized analysis techniques.
Network Aggregation
Combine information across layers into a single network:
from py3plex.core import random_generators
# Generate random multiplex network
network = random_generators.random_multiplex_ER(
num_nodes=500, num_layers=8, probability=0.0005, directed=False)
# Aggregate edges with different metrics
aggregated1 = network.aggregate_edges(metric="count", normalize_by="degree")
aggregated2 = network.aggregate_edges(metric="count", normalize_by="raw")
Examples
See:
example_multiplex_aggregate.py
- Network aggregationexample_multiplex_dynamics.py
- Temporal dynamicsexample_multiplex_community_detection.py
- Community detection
- Repository: https://github.com/SkBlaz/Py3Plex/tree/master/examples
## However, the weights differ! for e in aggregated_network2.edges(data=True):
print(e)
- for e in aggregated_network1.edges(data=True):
print(e)
The first network divides the contribution of an individual edge with the average node degree in a given layer, and the second one simply sums them.
Subsetting
Subsetting operates in the same manner than for multilayers, hence:
1 B = multinet.multi_layer_network(network_type="multiplex")
2 B.add_edges([[1,1,2,1,1],[1,2,3,2,1],[1,2,3,1,1],[2,1,3,2,1]],input_type="list")
3
4 ## subset the network by layers
5 C = B.subnetwork([2],subset_by="layers")
6 print(list(C.get_nodes()))
7
8 C = B.subnetwork([1],subset_by="node_names")
9 print(list(C.get_nodes()))
10
11 C = B.subnetwork([(1,1),(1,2)],subset_by="node_layer_names")
12 print(list(C.get_nodes()))