Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in CPDAG drawing #76

Closed
10 tasks done
aryan26roy opened this issue May 8, 2023 · 2 comments · Fixed by #77
Closed
10 tasks done

Bug in CPDAG drawing #76

aryan26roy opened this issue May 8, 2023 · 2 comments · Fixed by #77
Labels
bug Something isn't working

Comments

@aryan26roy
Copy link
Collaborator

aryan26roy commented May 8, 2023

Checklist

  • I have verified that the issue exists against the main branch.
  • I have read the relevant section in the contribution guide on reporting bugs.
  • I have checked the issues list for similar or identical bug reports.
  • I have checked the pull requests list for existing proposed fixes.
  • I have checked the CHANGELOG and the commit log to find out if the bug was already fixed in the main branch.
  • I have included in the "Description" section below a traceback from any exceptions related to this bug.
  • I have included in the "Related issues or possible duplicates" section beloew all related issues and possible duplicate issues (If there are none, check this box anyway).
  • I have included in the "Environment" section below the name of the operating system and Python version that I was using when I discovered this bug.
  • I have included in the "Environment" section below the output of pip freeze.
  • I have included in the "Steps to reproduce" section below a minimally reproducible example.

Description

When drawing a CPDAG with 4 nodes (even 3 nodes) the drawing shows more edges than the edge list displays.

{'directed': OutEdgeView([('xy', 'x'), ('x', 'z')]), 'undirected': EdgeView([])}

cpdag

{'directed': OutEdgeView([('xy', 'x'), ('x', 'z'), ('z', 'w')]), 'undirected': EdgeView([])}

cpdag

Python traceback:

Related issues or possible duplicates

  • None

Environment

OS: Ubuntu 22.10

Python version: 3.10.7

Output of pip freeze:

accessible-pygments==0.0.4
alabaster==0.7.13
ananke==0.1
attrs==22.2.0
Babel==2.12.1
backcall==0.2.0
bandit==1.7.4
beautifulsoup4==4.12.0
black==22.12.0
CacheControl==0.12.11
causal-learn==0.1.3.3
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
cleo==2.0.1
click==8.1.3
cloudpickle==2.2.1
codespell==2.2.4
contourpy==1.0.7
crashtest==0.4.1
cryptography==40.0.1
cycler==0.11.0
Cython==0.29.33
decorator==5.1.1
distlib==0.3.6
docutils==0.19
dowhy==0.9.1
dulwich==0.20.50
dunamai==1.16.0
econml==0.14.0
exceptiongroup==1.1.1
filelock==3.10.7
flake8==5.0.4
fonttools==4.39.3
-e git+ssh://[email protected]/scikit-hep/formulate.git@1658ad732fb441c11ce8fac08e3a4eda0d43d44f#egg=formulate
gitdb==4.0.10
GitPython==3.1.31
graphviz==0.20.1
html5lib==1.1
idna==3.4
imagesize==1.4.1
importlib-metadata==6.1.0
iniconfig==2.0.0
ipython==7.34.0
isort==5.12.0
jaraco.classes==3.2.3
jedi==0.18.2
jeepney==0.8.0
Jinja2==3.1.2
joblib==1.2.0
jsonschema==4.17.3
keyring==23.13.1
kiwisolver==1.4.4
lark==1.1.5
latexcodec==2.0.1
lightgbm==3.3.5
llvmlite==0.39.1
lockfile==0.12.2
MarkupSafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
mccabe==0.7.0
more-itertools==9.1.0
mpmath==1.3.0
msgpack==1.0.5
mypy==0.971
mypy-extensions==1.0.0
networkx==2.8.8
numba==0.56.4
numpy==1.23.5
numpydoc==1.5.0
packaging==23.0
paho-mqtt==1.6.1
pandas==1.5.3
parso==0.8.3
pastel==0.2.1
pathspec==0.11.0
patsy==0.5.3
pbr==5.11.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
pkginfo==1.9.6
platformdirs==3.1.0
pluggy==1.0.0
poethepoet==0.16.5
poetry==1.3.0
poetry-core==1.4.0
poetry-dynamic-versioning==0.21.4
poetry-plugin-export==1.3.0
pre-commit-hooks @ file:///home/aryan/.cache/pre-commit/repolkdstyo6
prompt-toolkit==3.0.38
ptyprocess==0.7.0
pybtex==0.24.0
pybtex-docutils==1.0.2
pycodestyle==2.9.1
pycparser==2.21
pydata-sphinx-theme==0.13.3
pydocstyle==6.3.0
pydot==1.4.2
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.0.9
pyrsistent==0.19.3
pytest==7.3.0
python-dateutil==2.8.2
pytz==2023.3
-e git+ssh://[email protected]/aryan26roy/pywhy-graphs.git@c13d202c7af244ff94a1c8d29d7740e62a3e7c93#egg=pywhy_graphs
PyYAML==6.0
rapidfuzz==2.13.7
requests==2.28.2
requests-toolbelt==0.10.1
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
ruff==0.0.263
scikit-learn==1.1.3
scipy==1.10.1
SecretStorage==3.3.3
shap==0.40.0
shellingham==1.5.0.post1
six==1.16.0
slicer==0.0.7
smmap==5.0.0
snowballstemmer==2.2.0
soupsieve==2.4
sparse==0.14.0
Sphinx==5.3.0
sphinx-copybutton==0.5.1
sphinx-gallery==0.12.2
sphinx-issues==3.0.1
sphinx_design==0.3.0
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-bibtex==2.5.0
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
statsmodels==0.13.5
stevedore==5.0.0
sympy==1.11.1
sync-with-poetry @ file:///home/aryan/.cache/pre-commit/repoat95e_7n
threadpoolctl==3.1.0
tokenize-rt==5.0.0
toml==0.10.2
tomli==2.0.1
tomlkit==0.7.2
tqdm==4.65.0
traitlets==5.9.0
trove-classifiers==2023.3.9
typing_extensions==4.5.0
urllib3==1.26.15
virtualenv==20.21.0
wcwidth==0.2.6
webencodings==0.5.1
zipp==3.15.0

Steps to reproduce

Example source:

import pywhy_graphs
from pywhy_graphs import CPDAG
from pywhy_graphs.viz import draw



cpdag = CPDAG()

cpdag.add_edge("xy", "x", cpdag.directed_edge_name)
cpdag.add_edge("x", "z", cpdag.directed_edge_name)
cpdag.add_edge("z", "w", cpdag.directed_edge_name) # comment out the edges to see it reproduced with less number of edges.

print(cpdag.edges())

dot_graph = draw(cpdag, name="bug")
dot_graph.render(outfile="cpdag.png", view=True)

@aryan26roy aryan26roy added the bug Something isn't working label May 8, 2023
@aryan26roy
Copy link
Collaborator Author

@adam2392 I hope the MVP is good.

@adam2392
Copy link
Collaborator

adam2392 commented May 8, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants