sg-dev / pathpy

pathpy is an OpenSource python package for the analysis of time series data on networks using higher-order and multi-order graphical models.
GNU Affero General Public License v3.0
2 stars 0 forks source link

Bug in transition matrix #82

Closed IngoScholtes closed 6 years ago

IngoScholtes commented 6 years ago

For undirected networks with self-loops, the function Network.transition_matrix() returns a wrong transition matrix, where rows do not sum to one.

Minimal example to reproduce:

n = pp.Network()
n.add_edge('a', 'b')
n.add_edge('a', 'a')
print(n.transition_matrix())

returns a transition matrix, where the row corresponding to node a sums to 1.5.

The reason for this bug is that in Network.transition_matrix() the entry for the self-loop is added twice, thus doubling ist weight in the Transition matrix.

IngoScholtes commented 6 years ago

closed in 8e50e35