Closed maximelucas closed 3 years ago
Running
import teneto as tnt TN = tnt.TemporalNetwork() tedges = [[1, 2, 100], [1, 2, 101], [1, 2, 102], [1, 2, 103]] TN.add_edge(tedges)
yields a TN.netshape of (3,4) and TN.N of 3 where in both cases the number of nodes should be 2 and not 3.
TN.netshape
TN.N
This is because the current line (322) in _calc_netshape in the TemporalNetwork class assumes integer node names and counts from 0:
_calc_netshape
TemporalNetwork
n_nodes = self.network[['i', 'j']].max(axis=1).max()+1
which we could replace it with this for example
n_nodes = len(np.unique(TN.network[['i', 'j']].values))
Nice catch.
Seems like a good suggestion, feel free to submit a PR! Or I'll add it when I do some small edits.
Closed in #79
Running
yields a
TN.netshape
of (3,4) andTN.N
of 3 where in both cases the number of nodes should be 2 and not 3.This is because the current line (322) in
_calc_netshape
in theTemporalNetwork
class assumes integer node names and counts from 0:which we could replace it with this for example