Closed Zhangmochen-zmc closed 1 month ago
Combined with the issue raised in issue5 (https://github.com/bolozna/Multilayer-networks-library/issues/5), I guess the developers set the maximum number of layers to 3 in order to fix the visualization bug.
"Aspect Concept" is not directly related with number of layers. You can set the aspect to 1 and come up with 50 layers, you know!
As @cloner174 mentioned, aspects and layers are different things. Number of aspects is the dimensionality of the layers. If you have genes as layers, then the network has one aspect. For example:
>>> M = pymnet.MultilayerNetwork(aspects=1)
>>> M[1,2,'gene1','gene2'] = 1
>>> M[2,3,'gene1','gene3'] = 1
>>> M[1,2,'gene4','gene3'] = 1
>>> list(M.iter_layers())
['gene1', 'gene2', 'gene4', 'gene3']
>>> list(M.edges)
[(1, 2, 'gene1', 'gene2', 1), (1, 2, 'gene4', 'gene3', 1), (2, 3, 'gene1', 'gene3', 1)]
See: https://mnets.github.io/pymnet/tutorial/networktypes.html#multilayer-networks
When I add edges of a single layer using the code like
mnet = MultilayerNetwork(aspects = 3)
andmnet[1,2,'gene','gene'] = 1
, it reports the error like "KeyError: 'Invalid number of indices.'". But when I change the aspects of the multilayer network to 2mnet = MultilayerNetwork(aspects = 2)
and run the same code to add edges, the program runs correctly. So what is the cause of this error?