akelleh / causality

Tools for causal analysis
MIT License
1.06k stars 128 forks source link

networkx version problem? #44

Closed jeroenbouwman closed 6 years ago

jeroenbouwman commented 6 years ago

I am trying to run the example given at the causality main github page but I run into the following problem:

Traceback (most recent call last):

File "", line 25, in graph = ic_algorithm.search(X, variable_types)

File "...../causality/inference/search/init.py", line 26, in search self._find_skeleton(data, variable_types)

File "......./causality/inference/search/init.py", line 126, in _find_skeleton z_candidates = list(set(x_neighbors + y_neighbors) - set([x,y]))

TypeError: unsupported operand type(s) for +: 'dict_keyiterator' and 'dict_keyiterator'

The x_neighbor and y_neighbors are variables returned by the networkx.Graph.neighbors function which returns an iterator over all neighbors of node n. At least for version 2.0 as is specified by the requirements.txt. For earlier versions (e.g. 1.10) this function returns a list of nodes that are adjacent to n. Can it be that the causality package only runs with version 1.10 of networkx and not the 2.0 verson?

thanks for the help, Jeroen

frmsaul commented 6 years ago

The most recent commit solves your issue. I don't think it was pushed to pypi yet (@akelleh, do you know?). You could either solve it by installing from source or use an earlier version of networkx.

Saul

akelleh commented 6 years ago

Not yet! I'll get on that tonight.

akelleh commented 6 years ago

should be resolved! upgrade to causality-0.0.5