mnets / pymnet

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

[REVIEW] Strange behaviours #27

Closed ClaudMor closed 3 months ago

ClaudMor commented 3 months ago

Dear authors,

While reviewing your package, I noticed the following unexpected behaviours:

  1. Assigning strings to edges is allowed:
from pymnet import *
net = MultilayerNetwork(aspects=0)
net[1,2] = "hello"
net[1,2] 
"hello"
  1. Modifying the MultilayerNetwork via a MultilayerNode:
from pymnet import *
net = MultilayerNetwork(aspects=0)
net.add_node(1)
net[1].mnet.add_node(2)
list(net)
[1, 2]

I understand that these behaviors do not break the software, therefore fixing them is not mandatory for this review. Anyway, for the future, I would like to respectively point out:

  1. Disallowing this by e.g. throwing and error;
  2. Using getters and setters, or name mangling;