akelleh / causality

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

Fix 'Graph' object has no attribute 'node' #84

Open jaryaman opened 4 years ago

jaryaman commented 4 years ago

Fix for #82, making the module compatible with NetworkX 2.4, see here

danielpcox commented 3 years ago

I've tested this successfully. Thanks!

pytest $HOME/.local/share/virtualenvs/rca-09xp6Szh/src/causality                                    2020-09-18 14:07:08
======================================================================= test session starts ========================================================================
platform linux -- Python 3.8.3, pytest-6.0.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/daniel.cox/.local/share/virtualenvs/rca-09xp6Szh/src/causality
collected 10 items

../../.local/share/virtualenvs/rca-09xp6Szh/src/causality/tests/unit/test_IC.py ........                                                                     [ 80%]
../../.local/share/virtualenvs/rca-09xp6Szh/src/causality/tests/unit/test_cit.py ..                                                                          [100%]

========================================================================= warnings summary =========================================================================
/home/daniel.cox/.local/share/virtualenvs/rca-09xp6Szh/lib/python3.8/site-packages/patsy/constraint.py:13
  /home/daniel.cox/.local/share/virtualenvs/rca-09xp6Szh/lib/python3.8/site-packages/patsy/constraint.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    from collections import Mapping

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================== 10 passed, 1 warning in 5.86s ===================================================================

Also, here's the output on the README examples.

image

zjcanjux commented 3 years ago

/causality/plot/init.py", line 36, in plot_marked_partially_directed_graph edge_labels={e: '*' for e in edges_ICstar['marked']}, arrowsize=arrowsize) TypeError: draw_networkx_edge_labels() got an unexpected keyword argument 'arrows'

test plot_marked_partially_directed_graph , one error occur