Skip to content

Commit

Permalink
Fix bug that appeared with NetworkX 2.0.
Browse files Browse the repository at this point in the history
Starting with the 2.0 release of NetworkX, `DiGraph.successors` returns an
iterator instead of a list. This caused `log_likelihood_network` to crash.
  • Loading branch information
lucasmaystre committed Nov 10, 2017
1 parent c756a46 commit 6ef2e58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion choix/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def log_likelihood_network(
for i in range(len(traffic_in)):
loglik += traffic_in[i] * params[i]
if digraph.out_degree(i) > 0:
neighbors = digraph.successors(i)
neighbors = list(digraph.successors(i))
if weight is None:
loglik -= traffic_out[i] * logsumexp(params.take(neighbors))
else:
Expand Down

0 comments on commit 6ef2e58

Please sign in to comment.