Created
March 21, 2023 17:48
-
-
Save SomeoneSerge/7b83d1d972755ccd4ec7accce2da0909 to your computer and use it in GitHub Desktop.
nix log /nix/store/pvi591yvwbmrxfsn8xnap2qnc1idxx0m-python3.10-retworkx-0.11.0.drv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sourcing python-remove-tests-dir-hook | |
Sourcing python-catch-conflicts-hook.sh | |
Sourcing python-remove-bin-bytecode-hook.sh | |
Sourcing pip-build-hook | |
Using pipBuildPhase | |
Using pipShellHook | |
Sourcing pip-install-hook | |
Using pipInstallPhase | |
Sourcing python-imports-check-hook.sh | |
Using pythonImportsCheckPhase | |
Sourcing python-namespaces-hook | |
Sourcing python-catch-conflicts-hook.sh | |
Sourcing pytest-check-hook | |
Using pytestCheckPhase | |
@nix { "action": "setPhase", "phase": "unpackPhase" } | |
unpacking sources | |
unpacking source archive /nix/store/5g136amf6s7kjl2ddppw802173qxlnfi-source | |
source root is source | |
Executing cargoSetupPostUnpackHook | |
unpacking source archive /nix/store/az9a8g8nq83pjglyyhl1mmzlg3fd1dh9-retworkx-0.11.0-vendor.tar.gz | |
Finished cargoSetupPostUnpackHook | |
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tox.ini | |
@nix { "action": "setPhase", "phase": "patchPhase" } | |
patching sources | |
Executing cargoSetupPostPatchHook | |
Validating consistency between /build/source/Cargo.lock and /build/retworkx-0.11.0-vendor.tar.gz/Cargo.lock | |
Finished cargoSetupPostPatchHook | |
@nix { "action": "setPhase", "phase": "configurePhase" } | |
configuring | |
no configure script, doing nothing | |
@nix { "action": "setPhase", "phase": "buildPhase" } | |
building | |
Executing maturinBuildHook | |
++ env CC_x86_64-unknown-linux-gnu=/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin/c++ CC_x86_64-unknown-linux-gnu=/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/rj91g41smpmp92xvhx6rjxz6878bn2b4-gcc-wrapper-12.2.0/bin/c++ maturin build --jobs=24 --frozen --target x86_64-unknown-linux-gnu --manylinux off --strip --release | |
⚠️ Warning: `build-backend` in pyproject.toml is not set to `maturin`, packaging tools such as pip will not use maturin to build this project. | |
🍹 Building a mixed python/rust project | |
🔗 Found pyo3 bindings | |
🐍 Found CPython 3.10 at /nix/store/0n4y44dnaxafqs7cg625aldrb152x7bx-python3-3.10.10/bin/python3 | |
[0m[0m[1m[32m Compiling[0m autocfg v1.0.1 | |
[0m[0m[1m[32m Compiling[0m cfg-if v1.0.0 | |
[0m[0m[1m[32m Compiling[0m libc v0.2.101 | |
[0m[0m[1m[32m Compiling[0m crossbeam-utils v0.8.5 | |
[0m[0m[1m[32m Compiling[0m lazy_static v1.4.0 | |
[0m[0m[1m[32m Compiling[0m scopeguard v1.1.0 | |
[0m[0m[1m[32m Compiling[0m crossbeam-epoch v0.9.5 | |
[0m[0m[1m[32m Compiling[0m rayon-core v1.9.1 | |
[0m[0m[1m[32m Compiling[0m proc-macro2 v1.0.29 | |
[0m[0m[1m[32m Compiling[0m unicode-xid v0.2.2 | |
[0m[0m[1m[32m Compiling[0m version_check v0.9.3 | |
[0m[0m[1m[32m Compiling[0m either v1.6.1 | |
[0m[0m[1m[32m Compiling[0m proc-macro-hack v0.5.19 | |
[0m[0m[1m[32m Compiling[0m pyo3-build-config v0.15.1 | |
[0m[0m[1m[32m Compiling[0m syn v1.0.76 | |
[0m[0m[1m[32m Compiling[0m once_cell v1.8.0 | |
[0m[0m[1m[32m Compiling[0m parking_lot_core v0.8.5 | |
[0m[0m[1m[32m Compiling[0m unindent v0.1.7 | |
[0m[0m[1m[32m Compiling[0m smallvec v1.6.1 | |
[0m[0m[1m[32m Compiling[0m rawpointer v0.2.1 | |
[0m[0m[1m[32m Compiling[0m ndarray v0.13.1 | |
[0m[0m[1m[32m Compiling[0m ppv-lite86 v0.2.10 | |
[0m[0m[1m[32m Compiling[0m fixedbitset v0.4.1 | |
[0m[0m[1m[32m Compiling[0m instant v0.1.10 | |
[0m[0m[1m[32m Compiling[0m lock_api v0.4.5 | |
[0m[0m[1m[32m Compiling[0m matrixmultiply v0.2.4 | |
[0m[0m[1m[32m Compiling[0m cfg-if v0.1.10 | |
[0m[0m[1m[32m Compiling[0m ahash v0.7.6 | |
[0m[0m[1m[32m Compiling[0m memoffset v0.6.4 | |
[0m[0m[1m[32m Compiling[0m num-traits v0.2.14 | |
[0m[0m[1m[32m Compiling[0m rayon v1.5.1 | |
[0m[0m[1m[32m Compiling[0m indexmap v1.7.0 | |
[0m[0m[1m[32m Compiling[0m num-integer v0.1.44 | |
[0m[0m[1m[32m Compiling[0m num-complex v0.2.4 | |
[0m[0m[1m[32m Compiling[0m num-bigint v0.4.3 | |
[0m[0m[1m[32m Compiling[0m crossbeam-channel v0.5.1 | |
[0m[0m[1m[32m Compiling[0m quote v1.0.9 | |
[0m[0m[1m[32m Compiling[0m getrandom v0.2.3 | |
[0m[0m[1m[32m Compiling[0m num_cpus v1.13.0 | |
[0m[0m[1m[32m Compiling[0m crossbeam-deque v0.8.1 | |
[0m[0m[1m[32m Compiling[0m rand_core v0.6.3 | |
[0m[0m[1m[32m Compiling[0m parking_lot v0.11.2 | |
[0m[0m[1m[32m Compiling[0m paste-impl v0.1.18 | |
[0m[0m[1m[32m Compiling[0m rand_chacha v0.3.1 | |
[0m[0m[1m[32m Compiling[0m rand_pcg v0.3.1 | |
[0m[0m[1m[32m Compiling[0m pyo3 v0.15.1 | |
[0m[0m[1m[32m Compiling[0m rand v0.8.4 | |
[0m[0m[1m[32m Compiling[0m num-complex v0.4.0 | |
[0m[0m[1m[32m Compiling[0m paste v0.1.18 | |
[0m[0m[1m[32m Compiling[0m hashbrown v0.11.2 | |
[0m[0m[1m[32m Compiling[0m pyo3-macros-backend v0.15.1 | |
[0m[0m[1m[32m Compiling[0m petgraph v0.6.0 | |
[0m[0m[1m[32m Compiling[0m indoc-impl v0.3.6 | |
[0m[0m[1m[32m Compiling[0m indoc v0.3.6 | |
[0m[0m[1m[32m Compiling[0m pyo3-macros v0.15.1 | |
[0m[0m[1m[32m Compiling[0m retworkx-core v0.11.0 (/build/source/retworkx-core) | |
[0m[0m[1m[32m Compiling[0m numpy v0.15.1 | |
[0m[0m[1m[32m Compiling[0m retworkx v0.11.0 (/build/source) | |
[0m[0m[1m[32m Finished[0m release [optimized] target(s) in 3m 49s | |
📦 Built wheel for CPython 3.10 to /build/source/target/wheels/retworkx-0.11.0-cp310-cp310-linux_x86_64.whl | |
Finished maturinBuildHook | |
buildPhase completed in 3 minutes 51 seconds | |
@nix { "action": "setPhase", "phase": "installPhase" } | |
installing | |
Executing pipInstallPhase | |
/build/source/dist /build/source | |
Processing ./retworkx-0.11.0-cp310-cp310-linux_x86_64.whl | |
Installing collected packages: retworkx | |
Successfully installed retworkx-0.11.0 | |
/build/source | |
Finished executing pipInstallPhase | |
@nix { "action": "setPhase", "phase": "pythonOutputDistPhase" } | |
pythonOutputDistPhase | |
Executing pythonOutputDistPhase | |
Finished executing pythonOutputDistPhase | |
@nix { "action": "setPhase", "phase": "fixupPhase" } | |
post-installation fixup | |
shrinking RPATHs of ELF executables and libraries in /nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0 | |
shrinking /nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/retworkx.cpython-310-x86_64-linux-gnu.so | |
checking for references to /build/ in /nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0... | |
patching script interpreter paths in /nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0 | |
stripping (with command strip and flags -S) in /nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib | |
shrinking RPATHs of ELF executables and libraries in /nix/store/c0n334lijj8hbq1xjpf7di69wkr1r8dv-python3.10-retworkx-0.11.0-dist | |
checking for references to /build/ in /nix/store/c0n334lijj8hbq1xjpf7di69wkr1r8dv-python3.10-retworkx-0.11.0-dist... | |
patching script interpreter paths in /nix/store/c0n334lijj8hbq1xjpf7di69wkr1r8dv-python3.10-retworkx-0.11.0-dist | |
Executing pythonRemoveTestsDir | |
Finished executing pythonRemoveTestsDir | |
@nix { "action": "setPhase", "phase": "installCheckPhase" } | |
running install tests | |
no Makefile or custom installCheckPhase, doing nothing | |
@nix { "action": "setPhase", "phase": "pythonCatchConflictsPhase" } | |
pythonCatchConflictsPhase | |
@nix { "action": "setPhase", "phase": "pythonRemoveBinBytecodePhase" } | |
pythonRemoveBinBytecodePhase | |
@nix { "action": "setPhase", "phase": "pythonImportsCheckPhase" } | |
pythonImportsCheckPhase | |
Executing pythonImportsCheckPhase | |
Check whether the following modules can be imported: retworkx | |
@nix { "action": "setPhase", "phase": "pytestCheckPhase" } | |
pytestCheckPhase | |
Executing pytestCheckPhase | |
/build/tmp.xoP1WHHEbE /build/source | |
[1m============================= test session starts ==============================[0m | |
platform linux -- Python 3.10.10, pytest-7.2.1, pluggy-1.0.0 | |
rootdir: /build/tmp.xoP1WHHEbE | |
[1mcollecting ... [0m[1m collecting 923 items [0m[1m collecting 1547 items [0m[1m collecting 1577 items [0m[1m collected 1577 items [0m | |
tests/test_converters.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 0%][0m | |
tests/test_custom_return_types.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 3%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 7%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 12%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 16%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 20%][0m | |
tests/test_dispatch.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 22%][0m | |
tests/test_random.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 24%][0m | |
tests/digraph/test_adj.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 25%][0m | |
tests/digraph/test_adjacency_matrix.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 26%][0m | |
tests/digraph/test_all_simple_paths.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 27%][0m | |
tests/digraph/test_ancestors_descendants.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 27%][0m | |
tests/digraph/test_astar.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 27%][0m | |
tests/digraph/test_avg_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 29%][0m | |
tests/digraph/test_bfs_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 29%][0m | |
tests/digraph/test_cartesian_product.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 29%][0m | |
tests/digraph/test_centrality.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 30%][0m | |
tests/digraph/test_collect_bicolor_runs.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 30%][0m | |
tests/digraph/test_collect_runs.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 31%][0m | |
tests/digraph/test_complement.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 31%][0m | |
tests/digraph/test_compose.py [32m.[0m[32m.[0m[32m.[0m[33m [ 31%][0m | |
tests/digraph/test_contract_nodes.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 32%][0m | |
tests/digraph/test_copy.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 32%][0m | |
tests/digraph/test_core_number.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 33%][0m | |
tests/digraph/test_deepcopy.py [32m.[0m[32m.[0m[32m.[0m[33m [ 33%][0m | |
tests/digraph/test_depth.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 34%][0m | |
tests/digraph/test_dfs_edges.py [32m.[0m[32m.[0m[33m [ 34%][0m | |
tests/digraph/test_dfs_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 34%][0m | |
tests/digraph/test_dijkstra.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 36%][0m | |
tests/digraph/test_dijkstra_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 36%][0m | |
tests/digraph/test_dist_matrix.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 37%][0m | |
tests/digraph/test_dot.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 37%][0m | |
tests/digraph/test_edgelist.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 38%][0m | |
tests/digraph/test_edges.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 41%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 44%][0m | |
tests/digraph/test_find_cycle.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 45%][0m | |
tests/digraph/test_floyd_warshall.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 47%][0m | |
tests/digraph/test_isomorphic.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 48%][0m | |
tests/digraph/test_k_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 49%][0m | |
tests/digraph/test_layers.py [32m.[0m[32m.[0m[33m [ 49%][0m | |
tests/digraph/test_layout.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 51%][0m | |
tests/digraph/test_neighbors.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 51%][0m | |
tests/digraph/test_nodes.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 54%][0m | |
tests/digraph/test_num_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 54%][0m | |
tests/digraph/test_pred_succ.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 55%][0m | |
tests/digraph/test_spring_layout.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 56%][0m | |
tests/digraph/test_strongly_connected.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 56%][0m | |
tests/digraph/test_subgraph.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 57%][0m | |
tests/digraph/test_subgraph_isomorphic.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 58%][0m | |
tests/digraph/test_substitute_node_with_subgraph.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 59%][0m | |
tests/digraph/test_symmetric.py [32m.[0m[32m.[0m[33m [ 59%][0m | |
tests/digraph/test_to_undirected.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 59%][0m | |
tests/digraph/test_toposort.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 60%][0m | |
tests/digraph/test_transitivity.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 60%][0m | |
tests/digraph/test_union.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 60%][0m | |
tests/digraph/test_weakly_connected.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 61%][0m | |
tests/generators/test_barbell.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 61%][0m | |
tests/generators/test_binomial_tree.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 62%][0m | |
tests/generators/test_cycle.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 62%][0m | |
tests/generators/test_full_rary_tree.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 63%][0m | |
tests/generators/test_grid.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 63%][0m | |
tests/generators/test_heavy_hex.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 64%][0m | |
tests/generators/test_heavy_square.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 64%][0m | |
tests/generators/test_hexagonal.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 65%][0m | |
tests/generators/test_lollipop.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 66%][0m | |
tests/generators/test_mesh.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 66%][0m | |
tests/generators/test_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 66%][0m | |
tests/generators/test_petersen.py [32m.[0m[32m.[0m[32m.[0m[33m [ 67%][0m | |
tests/generators/test_star.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 67%][0m | |
tests/graph/test_adj.py [32m.[0m[32m.[0m[33m [ 67%][0m | |
tests/graph/test_adjencency_matrix.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 69%][0m | |
tests/graph/test_all_simple_paths.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 69%][0m | |
tests/graph/test_astar.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 70%][0m | |
tests/graph/test_avg_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 70%][0m | |
tests/graph/test_bfs_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 71%][0m | |
tests/graph/test_biconnected.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 71%][0m | |
tests/graph/test_cartesian_product.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 71%][0m | |
tests/graph/test_centrality.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 72%][0m | |
tests/graph/test_chain_decomposition.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 72%][0m | |
tests/graph/test_coloring.py [32m.[0m[32m.[0m[32m.[0m[33m [ 72%][0m | |
tests/graph/test_complement.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 72%][0m | |
tests/graph/test_compose.py [32m.[0m[32m.[0m[32m.[0m[33m [ 73%][0m | |
tests/graph/test_connected_components.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 73%][0m | |
tests/graph/test_contract_nodes.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 74%][0m | |
tests/graph/test_copy.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 74%][0m | |
tests/graph/test_core_number.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 74%][0m | |
tests/graph/test_cycle_basis.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 75%][0m | |
tests/graph/test_deepcopy.py [32m.[0m[32m.[0m[32m.[0m[33m [ 75%][0m | |
tests/graph/test_dfs_edges.py [32m.[0m[32m.[0m[33m [ 75%][0m | |
tests/graph/test_dfs_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 75%][0m | |
tests/graph/test_dijkstra.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 76%][0m | |
tests/graph/test_dijkstra_search.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 77%][0m | |
tests/graph/test_dist_matrix.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 77%][0m | |
tests/graph/test_dot.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 77%][0m | |
tests/graph/test_edgelist.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 78%][0m | |
tests/graph/test_edges.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 81%] | |
[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 84%][0m | |
tests/graph/test_floyd_warshall.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 86%][0m | |
tests/graph/test_isomorphic.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 87%][0m | |
tests/graph/test_k_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 88%][0m | |
tests/graph/test_layout.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 90%][0m | |
tests/graph/test_matching.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 90%][0m | |
tests/graph/test_max_weight_matching.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 92%][0m | |
tests/graph/test_mst.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 92%][0m | |
tests/graph/test_neighbors.py [32m.[0m[32m.[0m[32m.[0m[33m [ 93%][0m | |
tests/graph/test_nodes.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 94%][0m | |
tests/graph/test_num_shortest_path.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 94%][0m | |
tests/graph/test_spring_layout.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 95%][0m | |
tests/graph/test_steiner_tree.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 95%][0m | |
tests/graph/test_subgraph.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 96%][0m | |
tests/graph/test_subgraph_isomorphic.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 97%][0m | |
tests/graph/test_to_directed.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 98%][0m | |
tests/graph/test_transitivity.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 98%][0m | |
tests/graph/test_union.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[33m [ 98%][0m | |
tests/visualization/test_graphviz.py [33ms[0m[33ms[0m[33ms[0m[33ms[0m[33ms[0m[33ms[0m[33ms[0m[33ms[0m[33ms[0m[33m [ 99%][0m | |
tests/visualization/test_mpl.py [31mF[0m[31mF[0m[32m.[0m[31mF[0m[32m.[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[32m.[0m[31m [100%][0m | |
=================================== FAILURES =================================== | |
[31m[1m_________________________ TestMPLDraw.test_alpha_iter __________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_alpha_iter> | |
def test_alpha_iter(self): | |
graph = retworkx.generators.grid_graph(4, 6) | |
# with fewer alpha elements than nodes | |
plt.subplot(131) | |
> mpl_draw(graph, alpha=[0.1, 0.2]) | |
[1m[31mtests/visualization/test_mpl.py[0m:130: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7fff27646540>, pos = None, ax = None | |
arrows = True, with_labels = False, kwds = {'alpha': [0.1, 0.2]} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m___________________________ TestMPLDraw.test_arrows ____________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_arrows> | |
def test_arrows(self): | |
graph = retworkx.generators.directed_star_graph(24) | |
> fig = mpl_draw(graph) | |
[1m[31mtests/visualization/test_mpl.py[0m:72: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyDiGraph object at 0x7ffff7458460>, pos = None, ax = None | |
arrows = True, with_labels = False, kwds = {} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m____________________________ TestMPLDraw.test_draw _____________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_draw> | |
def test_draw(self): | |
graph = retworkx.generators.star_graph(24) | |
options = {"node_color": "black", "node_size": 100, "width": 3} | |
> fig = mpl_draw(graph, **options) | |
[1m[31mtests/visualization/test_mpl.py[0m:49: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7fff24276540>, pos = None, ax = None | |
arrows = True, with_labels = False | |
kwds = {'node_color': 'black', 'node_size': 100, 'width': 3} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m________________________ TestMPLDraw.test_edge_colormap ________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_edge_colormap> | |
def test_edge_colormap(self): | |
graph = retworkx.generators.star_graph(24) | |
colors = range(len(graph.edge_list())) | |
> fig = mpl_draw( | |
graph, | |
edge_color=colors, | |
width=4, | |
edge_cmap=plt.cm.Blues, | |
with_labels=True, | |
) | |
[1m[31mtests/visualization/test_mpl.py[0m:61: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7fff242769c0>, pos = None, ax = None | |
arrows = True, with_labels = True | |
kwds = {'edge_cmap': <matplotlib.colors.LinearSegmentedColormap object at 0x7fff2cca2050>, 'edge_color': range(0, 23), 'width': 4} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m_________________________ TestMPLDraw.test_empty_graph _________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_empty_graph> | |
def test_empty_graph(self): | |
graph = retworkx.PyGraph() | |
> fig = mpl_draw(graph) | |
[1m[31mtests/visualization/test_mpl.py[0m:77: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7ffff5900840>, pos = None, ax = None | |
arrows = True, with_labels = False, kwds = {} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m______________________ TestMPLDraw.test_labels_and_colors ______________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_labels_and_colors> | |
def test_labels_and_colors(self): | |
graph = retworkx.PyGraph() | |
graph.add_nodes_from(list(range(8))) | |
edge_list = [ | |
(0, 1, 5), | |
(1, 2, 2), | |
(2, 3, 7), | |
(3, 0, 6), | |
(5, 6, 1), | |
(4, 5, 7), | |
(6, 7, 3), | |
(7, 4, 7), | |
] | |
labels = {} | |
labels[0] = r"$a$" | |
labels[1] = r"$b$" | |
labels[2] = r"$c$" | |
labels[3] = r"$d$" | |
labels[4] = r"$\alpha$" | |
labels[5] = r"$\beta$" | |
labels[6] = r"$\gamma$" | |
labels[7] = r"$\delta$" | |
graph.add_edges_from(edge_list) | |
pos = retworkx.random_layout(graph) | |
> mpl_draw( | |
graph, | |
pos=pos, | |
node_list=[0, 1, 2, 3], | |
node_color="r", | |
edge_list=[(0, 1), (1, 2), (2, 3), (3, 0)], | |
node_size=500, | |
alpha=0.75, | |
width=1.0, | |
labels=lambda x: labels[x], | |
font_size=16, | |
) | |
[1m[31mtests/visualization/test_mpl.py[0m:168: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7fff24280540> | |
pos = <retworkx.Pos2DMapping object at 0x7fff242837c0>, ax = None, arrows = True | |
with_labels = False | |
kwds = {'alpha': 0.75, 'edge_list': [(0, 1), (1, 2), (2, 3), (3, 0)], 'font_size': 16, 'labels': <function TestMPLDraw.test_labels_and_colors.<locals>.<lambda> at 0x7fff04160a60>, ...} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[31m[1m__________________________ TestMPLDraw.test_node_list __________________________[0m | |
self = <tests.visualization.test_mpl.TestMPLDraw testMethod=test_node_list> | |
def test_node_list(self): | |
graph = retworkx.generators.star_graph(24) | |
node_list = list(range(4)) + list(range(4, 10)) + list(range(10, 14)) | |
> fig = mpl_draw(graph, node_list=node_list) | |
[1m[31mtests/visualization/test_mpl.py[0m:55: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
graph = <retworkx.PyGraph object at 0x7fff242835c0>, pos = None, ax = None | |
arrows = True, with_labels = False | |
kwds = {'node_list': [0, 1, 2, 3, 4, 5, ...]} | |
plt = <module 'matplotlib.pyplot' from '/nix/store/w19ags7fn0h3vf1whck5pg548xan9afg-python3.10-matplotlib-3.7.0/lib/python3.10/site-packages/matplotlib/pyplot.py'> | |
cf = <Figure size 640x480 with 1 Axes> | |
def mpl_draw(graph, pos=None, ax=None, arrows=True, with_labels=False, **kwds): | |
r"""Draw a graph with Matplotlib. | |
.. note:: | |
Matplotlib is an optional dependency and will not be installed with | |
retworkx by default. If you intend to use this function make sure that | |
you install matplotlib with either ``pip install matplotlib`` or | |
``pip install 'retworkx[mpl]'`` | |
:param graph: A retworkx graph, either a :class:`~retworkx.PyGraph` or a | |
:class:`~retworkx.PyDiGraph`. | |
:param dict pos: An optional dictionary (or | |
a :class:`~retworkx.Pos2DMapping` object) with nodes as keys and | |
positions as values. If not specified a spring layout positioning will | |
be computed. See `layout_functions` for functions that compute | |
node positions. | |
:param matplotlib.Axes ax: An optional Matplotlib Axes object to draw the | |
graph in. | |
:param bool arrows: For :class:`~retworkx.PyDiGraph` objects if ``True`` | |
draw arrowheads. (defaults to ``True``) Note, that the Arrows will | |
be the same color as edges. | |
:param str arrowstyle: An optional string for directed graphs to choose | |
the style of the arrowsheads. See | |
:class:`matplotlib.patches.ArrowStyle` for more options. By default the | |
value is set to ``'-\|>'``. | |
:param int arrow_size: For directed graphs, choose the size of the arrow | |
head's length and width. See | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and constructor | |
kwarg ``mutation_scale`` for more info. Defaults to 10. | |
:param bool with_labels: Set to ``True`` to draw labels on the nodes. Edge | |
labels will only be drawn if the ``edge_labels`` parameter is set to a | |
function. Defaults to ``False``. | |
:param list node_list: An optional list of node indices in the graph to | |
draw. If not specified all nodes will be drawn. | |
:param list edge_list: An option list of edges in the graph to draw. If not | |
specified all edges will be drawn | |
:param int|list node_size: Optional size of nodes. If an array is | |
specified it must be the same length as node_list. Defaults to 300 | |
:param node_color: Optional node color. Can be a single color or | |
a sequence of colors with the same length as node_list. Color can be | |
string or rgb (or rgba) tuple of floats from 0-1. If numeric values | |
are specified they will be mapped to colors using the ``cmap`` and | |
``vmin``,``vmax`` parameters. See :func:`matplotlib.scatter` for more | |
details. Defaults to ``'#1f78b4'``) | |
:param str node_shape: The optional shape node. The specification is the | |
same as the :func:`matplotlib.pyplot.scatter` function's ``marker`` | |
kwarg, valid options are one of | |
``['s', 'o', '^', '>', 'v', '<', 'd', 'p', 'h', '8']``. Defaults to | |
``'o'`` | |
:param float alpha: Optional value for node and edge transparency | |
:param matplotlib.colors.Colormap cmap: An optional Matplotlib colormap | |
object for mapping intensities of nodes | |
:param float vmin: Optional minimum value for node colormap scaling | |
:param float vmax: Optional minimum value for node colormap scaling | |
:param float|sequence linewidths: An optional line width for symbol | |
borders. If a sequence is specified it must be the same length as | |
node_list. Defaults to 1.0 | |
:param float|sequence width: An optional width to use for edges. Can | |
either be a float or sequence of floats. If a sequence is specified | |
it must be the same length as node_list. Defaults to 1.0 | |
:param str|sequence edge_color: color or array of colors (default='k') | |
Edge color. Can be a single color or a sequence of colors with the same | |
length as edge_list. Color can be string or rgb (or rgba) tuple of | |
floats from 0-1. If numeric values are specified they will be | |
mapped to colors using the ``edge_cmap`` and ``edge_vmin``, | |
``edge_vmax`` parameters. | |
:param matplotlib.colors.Colormap edge_cmap: An optional Matplotlib | |
colormap for mapping intensities of edges. | |
:param float edge_vmin: Optional minimum value for edge colormap scaling | |
:param float edge_vmax: Optional maximum value for node colormap scaling | |
:param str style: An optional string to specify the edge line style. | |
For example, ``'-'``, ``'--'``, ``'-.'``, ``':'`` or words like | |
``'solid'`` or ``'dashed'``. See the | |
:class:`matplotlib.patches.FancyArrowPatch` attribute and kwarg | |
``linestyle`` for more details. Defaults to ``'solid'``. | |
:param func labels: An optional callback function that will be passed a | |
node payload and return a string label for the node. For example:: | |
labels=str | |
could be used to just return a string cast of the node's data payload. | |
Or something like:: | |
labels=lambda node: node['label'] | |
could be used if the node payloads are dictionaries. | |
:param func edge_labels: An optional callback function that will be passed | |
an edge payload and return a string label for the edge. For example:: | |
edge_labels=str | |
could be used to just return a string cast of the edge's data payload. | |
Or something like:: | |
edge_labels=lambda edge: edge['label'] | |
could be used if the edge payloads are dictionaries. If this is set | |
edge labels will be drawn in the visualization. | |
:param int font_size: An optional fontsize to use for text labels, By | |
default a value of 12 is used for nodes and 10 for edges. | |
:param str font_color: An optional font color for strings. By default | |
``'k'`` (ie black) is set. | |
:param str font_weight: An optional string used to specify the font weight. | |
By default a value of ``'normal'`` is used. | |
:param str font_family: An optional font family to use for strings. By | |
default ``'sans-serif'`` is used. | |
:param str label: An optional string label to use for the graph legend. | |
:param str connectionstyle: An optional value used to create a curved arc | |
of rounding radius rad. For example, | |
``connectionstyle='arc3,rad=0.2'``. See | |
:class:`matplotlib.patches.ConnectionStyle` and | |
:class:`matplotlib.patches.FancyArrowPatch` for more info. By default | |
this is set to ``"arc3"``. | |
:returns: A matplotlib figure for the visualization if not running with an | |
interactive backend (like in jupyter) or if ``ax`` is not set. | |
:rtype: matplotlib.figure.Figure | |
For Example: | |
.. jupyter-execute:: | |
import matplotlib.pyplot as plt | |
import retworkx | |
from retworkx.visualization import mpl_draw | |
G = retworkx.generators.directed_path_graph(25) | |
mpl_draw(G) | |
plt.draw() | |
""" | |
try: | |
import matplotlib.pyplot as plt | |
except ImportError as e: | |
raise ImportError( | |
"matplotlib needs to be installed prior to running " | |
"retworkx.visualization.mpl_draw(). You can install " | |
"matplotlib with:\n'pip install matplotlib'" | |
) from e | |
if ax is None: | |
cf = plt.gcf() | |
else: | |
cf = ax.get_figure() | |
cf.set_facecolor("w") | |
if ax is None: | |
> if cf._axstack() is None: | |
[1m[31mE TypeError: '_AxesStack' object is not callable[0m | |
[1m[31m/nix/store/2x320q4976sx7qhy8y1lj751l18f8y8p-python3.10-retworkx-0.11.0/lib/python3.10/site-packages/retworkx/visualization/matplotlib.py[0m:212: TypeError | |
[33m=============================== warnings summary ===============================[0m | |
../../nix/store/7jg7sp884jb2y1izw0gkgigjsi2n7m32-python3.10-testtools-2.5.0/lib/python3.10/site-packages/testtools/distutilscmd.py:7 | |
/nix/store/7jg7sp884jb2y1izw0gkgigjsi2n7m32-python3.10-testtools-2.5.0/lib/python3.10/site-packages/testtools/distutilscmd.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives | |
from distutils.core import Command | |
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html | |
[36m[1m=========================== short test summary info ============================[0m | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_alpha_iter[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_arrows[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_draw[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_edge_colormap[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_empty_graph[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_labels_and_colors[0m - TypeError: '_AxesStack' object is not callable | |
[31mFAILED[0m tests/visualization/test_mpl.py::[1mTestMPLDraw::test_node_list[0m - TypeError: '_AxesStack' object is not callable | |
[31m============ [31m[1m7 failed[0m, [32m1561 passed[0m, [33m9 skipped[0m, [33m1 warning[0m[31m in 21.99s[0m[31m =============[0m | |
/nix/store/pw17yc3mwmsci4jygwalj8ppg0drz31v-stdenv-linux/setup: line 1593: pop_var_context: head of shell_variables not a function context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment