From 55a9ef7f6928d28022f2234b1b9c17d65a971a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20F=C3=B6rster?= Date: Wed, 3 Jul 2024 18:01:33 +0200 Subject: [PATCH] adjustment of skewed edge weights --- pdm.lock | 205 ++++++++-- pyproject.toml | 6 +- src/lang_main/analysis/graphs.py | 103 ++++- src/lang_main/constants.py | 1 + test-notebooks/misc.ipynb | 672 ++++++++++++++++++++++++++----- 5 files changed, 853 insertions(+), 134 deletions(-) diff --git a/pdm.lock b/pdm.lock index d5035c3..7607253 100644 --- a/pdm.lock +++ b/pdm.lock @@ -2,17 +2,17 @@ # It is not intended for manual editing. [metadata] -groups = ["default", "notebooks", "trials", "trails"] +groups = ["default", "notebooks", "trials", "trails", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.2" -content_hash = "sha256:36979d60d30dad28e15e0f93496b4ea25af7fc5a12b91e82c12e1b957325c0af" +content_hash = "sha256:5c4c7b58272b6a8845865dde1fc6c953611f3e9424823eea35682da5cb6e112c" [[package]] name = "alph" version = "0.4.10" requires_python = "<4.0,>=3.9" summary = "alph" -groups = ["trails", "trials"] +groups = ["trials"] dependencies = [ "altair>=5.0.1", "networkx>=2.6.3", @@ -30,7 +30,7 @@ version = "0.4.10" extras = ["graphviz"] requires_python = "<4.0,>=3.9" summary = "alph" -groups = ["trails", "trials"] +groups = ["trials"] dependencies = [ "alph==0.4.10", "pygraphviz>=1.10", @@ -45,7 +45,7 @@ name = "altair" version = "5.3.0" requires_python = ">=3.8" summary = "Vega-Altair: A declarative statistical visualization library for Python." -groups = ["trails", "trials"] +groups = ["trials"] dependencies = [ "jinja2", "jsonschema>=3.0", @@ -188,7 +188,7 @@ name = "attrs" version = "23.2.0" requires_python = ">=3.7" summary = "Classes Without Boilerplate" -groups = ["notebooks", "trails", "trials"] +groups = ["notebooks", "trials"] files = [ {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, @@ -205,6 +205,17 @@ files = [ {file = "babel-2.15.0.tar.gz", hash = "sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413"}, ] +[[package]] +name = "backoff" +version = "2.2.1" +requires_python = ">=3.7,<4.0" +summary = "Function decoration for backoff and retry" +groups = ["trials"] +files = [ + {file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"}, + {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, +] + [[package]] name = "beautifulsoup4" version = "4.12.3" @@ -283,7 +294,7 @@ name = "certifi" version = "2024.2.2" requires_python = ">=3.6" summary = "Python package for providing Mozilla's CA Bundle." -groups = ["default", "notebooks"] +groups = ["default", "notebooks", "trials"] files = [ {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, @@ -323,12 +334,23 @@ files = [ {file = "cffi-1.16.0.tar.gz", hash = "sha256:bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0"}, ] +[[package]] +name = "chardet" +version = "5.2.0" +requires_python = ">=3.7" +summary = "Universal encoding detector for Python 3" +groups = ["trials"] +files = [ + {file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"}, + {file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"}, +] + [[package]] name = "charset-normalizer" version = "3.3.2" requires_python = ">=3.7.0" summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -groups = ["default", "notebooks"] +groups = ["default", "notebooks", "trials"] files = [ {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, @@ -401,6 +423,29 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "colorbrewer" +version = "0.2.0" +summary = "constants from Cynthia Brewer's ColorBrewer" +groups = ["trials"] +dependencies = [ + "six", +] +files = [ + {file = "colorbrewer-0.2.0-py3-none-any.whl", hash = "sha256:b0e6a7dd472174f6a7691db55a0ca79f4ab63780d6c62c3acff78b5920f3e249"}, + {file = "colorbrewer-0.2.0.tar.gz", hash = "sha256:f124d0051086887b52d3643203a7722252b50204f8af93e6ae63fc0013f42456"}, +] + +[[package]] +name = "colour" +version = "0.1.5" +summary = "converts and manipulates various color representation (HSL, RVB, web, X11, ...)" +groups = ["trials"] +files = [ + {file = "colour-0.1.5-py2.py3-none-any.whl", hash = "sha256:33f6db9d564fadc16e59921a56999b79571160ce09916303d35346dddc17978c"}, + {file = "colour-0.1.5.tar.gz", hash = "sha256:af20120fefd2afede8b001fbef2ea9da70ad7d49fafdb6489025dae8745c3aee"}, +] + [[package]] name = "comm" version = "0.2.2" @@ -449,6 +494,33 @@ files = [ {file = "cymem-2.0.8.tar.gz", hash = "sha256:8fb09d222e21dcf1c7e907dc85cf74501d4cea6c4ed4ac6c9e016f98fb59cbbf"}, ] +[[package]] +name = "cython" +version = "3.0.10" +requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +summary = "The Cython compiler for writing C extensions in the Python language." +groups = ["dev"] +files = [ + {file = "Cython-3.0.10-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:051069638abfb076900b0c2bcb6facf545655b3f429e80dd14365192074af5a4"}, + {file = "Cython-3.0.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:712760879600907189c7d0d346851525545484e13cd8b787e94bfd293da8ccf0"}, + {file = "Cython-3.0.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:38d40fa1324ac47c04483d151f5e092406a147eac88a18aec789cf01c089c3f2"}, + {file = "Cython-3.0.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5bd49a3a9fdff65446a3e1c2bfc0ec85c6ce4c3cad27cd4ad7ba150a62b7fb59"}, + {file = "Cython-3.0.10-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e8df79b596633b8295eaa48b1157d796775c2bb078f32267d32f3001b687f2fd"}, + {file = "Cython-3.0.10-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:bcc9795990e525c192bc5c0775e441d7d56d7a7d02210451e9e13c0448dba51b"}, + {file = "Cython-3.0.10-cp311-cp311-win32.whl", hash = "sha256:09f2000041db482cad3bfce94e1fa3a4c82b0e57390a164c02566cbbda8c4f12"}, + {file = "Cython-3.0.10-cp311-cp311-win_amd64.whl", hash = "sha256:3919a55ec9b6c7db6f68a004c21c05ed540c40dbe459ced5d801d5a1f326a053"}, + {file = "Cython-3.0.10-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:8f2864ab5fcd27a346f0b50f901ebeb8f60b25a60a575ccfd982e7f3e9674914"}, + {file = "Cython-3.0.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:407840c56385b9c085826fe300213e0e76ba15d1d47daf4b58569078ecb94446"}, + {file = "Cython-3.0.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5a036d00caa73550a3a976432ef21c1e3fa12637e1616aab32caded35331ae96"}, + {file = "Cython-3.0.10-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9cc6a0e7e23a96dec3f3c9d39690d4281beabd5297855140d0d30855f950275e"}, + {file = "Cython-3.0.10-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:a5e14a8c6a8157d2b0cdc2e8e3444905d20a0e78e19d2a097e89fb8b04b51f6b"}, + {file = "Cython-3.0.10-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f8a2b8fa0fd8358bccb5f3304be563c4750aae175100463d212d5ea0ec74cbe0"}, + {file = "Cython-3.0.10-cp312-cp312-win32.whl", hash = "sha256:2d29e617fd23cf4b83afe8f93f2966566c9f565918ad1e86a4502fe825cc0a79"}, + {file = "Cython-3.0.10-cp312-cp312-win_amd64.whl", hash = "sha256:6c5af936940a38c300977b81598d9c0901158f220a58c177820e17e1774f1cf1"}, + {file = "Cython-3.0.10-py2.py3-none-any.whl", hash = "sha256:fcbb679c0b43514d591577fd0d20021c55c240ca9ccafbdb82d3fb95e5edfee2"}, + {file = "Cython-3.0.10.tar.gz", hash = "sha256:dcc96739331fb854dcf503f94607576cfe8488066c61ca50dfd55836f132de99"}, +] + [[package]] name = "dash" version = "2.17.0" @@ -541,7 +613,7 @@ name = "decorator" version = "5.1.1" requires_python = ">=3.5" summary = "Decorators for Humans" -groups = ["notebooks"] +groups = ["notebooks", "trials"] files = [ {file = "decorator-5.1.1-py3-none-any.whl", hash = "sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186"}, {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, @@ -699,12 +771,53 @@ name = "idna" version = "3.7" requires_python = ">=3.5" summary = "Internationalized Domain Names in Applications (IDNA)" -groups = ["default", "notebooks"] +groups = ["default", "notebooks", "trials"] files = [ {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] +[[package]] +name = "igraph" +version = "0.11.5" +requires_python = ">=3.8" +summary = "High performance graph data structures and algorithms" +groups = ["trials"] +dependencies = [ + "texttable>=1.6.2", +] +files = [ + {file = "igraph-0.11.5-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:164718e7dcf3096c2e73d26c4c98c5f963033af1148b1fa390ff916eb31dd31d"}, + {file = "igraph-0.11.5-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:7ea75561e921e05635e67a98735aca240e4bbc8df5909eb3b8df196fca334c31"}, + {file = "igraph-0.11.5-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9bcfd3c9308150d69644744c6bec1ff75a3dd7ea9b4fa6f9587664ef88d271a"}, + {file = "igraph-0.11.5-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:845cb179a0876c6c23eb0869bb984f85cd8131f8131595e935e902020df1327e"}, + {file = "igraph-0.11.5-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0eb2fd96b729ce2f6eb7a2e95ec1b522ca7359e10c5609a7e3b686777bab89f4"}, + {file = "igraph-0.11.5-cp39-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:e6eac30df9294c3d9de73c1975358600b3230e408c2292a7a2e145e42faf12a8"}, + {file = "igraph-0.11.5-cp39-abi3-musllinux_1_1_i686.whl", hash = "sha256:3c98990f785117b00ff077d96aa9080d6934a21fdd1c2c06d3f4945ac212a6ac"}, + {file = "igraph-0.11.5-cp39-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:ff3ba7a82a0a1b42bfcda6a379f3de78e0dabf84d0d582083ddecc52fdc81a40"}, + {file = "igraph-0.11.5-cp39-abi3-win32.whl", hash = "sha256:db8e4942574c6b4b0afb8d219a9a8e38e75d3cc3bad68aa7f438e8604a7d4d8a"}, + {file = "igraph-0.11.5-cp39-abi3-win_amd64.whl", hash = "sha256:034c1f8b50d58c911c2ff45cf299fb64255aa0ede6fa880a75d8d7493da743d8"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:e4970886a79c1641d082a31cc2bbc17de956929e091770af0c3a37971f44568f"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:213ee64c8dfe03ca2d9e6a0fa87f283decc44c79d94b75121acf97753bedc21e"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8850b29d63e218da70f8a05cb29af3166c2ccdda3b7a44902cf05a5f0d234ec8"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f68f020e4f83d6764952c48c7401316e33d0336607551711282b0177df0e9732"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa5239c3b4405eddb424ffcd3c21a4e7d3e8f170d2da54b6c8e2bd980f4c1130"}, + {file = "igraph-0.11.5-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:59a66ff91a9d7e60b61fb842e1c1b987e258fb95d1d366b998d3e83948939a19"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:29698baa1ada3bdbb746b03e8cfedfa950c8ebf91a3ed466ec423aa5d03552fd"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:7da25d7966f5934de245370b67b7ed47bded36d32ab21a9bc78b710d07b48732"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e00ac0542f014ef966f19629112065f6366fda4cd164b6107f8245868ebb0667"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c51a9405b47f5b14ceabc4cf47ac2a440cead0a032fac6b22f2f171b09266ea8"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49aa55e8bac8eb41f712340154d37c96b3021131ba72769006aa5ce354a275f8"}, + {file = "igraph-0.11.5-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:2ff0162bad7e9b88d3de3afffcb509413a1173359b10b59625ecdfc69b0602cd"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:848206e8db2d47b9a252a994105f963eb03bce0c7455c5478478a02734cd4cc3"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:ba42b1b38c8cd3fd4ed73bbe9f9f7da2d8c7457e3b61ddd235deed9593fc26c8"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63074458ba8c26057cc22db46cace78276db4b3e9f231e3b2047139979647ffc"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1a7fe9a87b9b904d14cfe0167ae8f7231a4cb951969652372b4a3b2cb23ca827"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dfdd7266080e96d0a569e13ebd6219d2bd1cfabaa4db8c5ba8380360fccd0883"}, + {file = "igraph-0.11.5-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:4305185b65cb6b2e8a22c9d5e834978093d4a8a65dd71dc42db7a13f8614864d"}, + {file = "igraph-0.11.5.tar.gz", hash = "sha256:2d71d645a4c3344c5910543fabbae10d3163f46a3e824ba7753c14b9036b8233"}, +] + [[package]] name = "importlib-metadata" version = "7.1.0" @@ -844,7 +957,7 @@ name = "jinja2" version = "3.1.4" requires_python = ">=3.7" summary = "A very fast and expressive template engine." -groups = ["default", "notebooks", "trails", "trials"] +groups = ["default", "notebooks", "trials"] dependencies = [ "MarkupSafe>=2.0", ] @@ -891,7 +1004,7 @@ name = "jsonschema" version = "4.22.0" requires_python = ">=3.8" summary = "An implementation of JSON Schema validation for Python" -groups = ["notebooks", "trails", "trials"] +groups = ["notebooks", "trials"] dependencies = [ "attrs>=22.2.0", "jsonschema-specifications>=2023.03.6", @@ -908,7 +1021,7 @@ name = "jsonschema-specifications" version = "2023.12.1" requires_python = ">=3.8" summary = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -groups = ["notebooks", "trails", "trials"] +groups = ["notebooks", "trials"] dependencies = [ "referencing>=0.31.0", ] @@ -1212,7 +1325,7 @@ name = "markupsafe" version = "2.1.5" requires_python = ">=3.7" summary = "Safely add untrusted strings to HTML/XML markup." -groups = ["default", "notebooks", "trails", "trials"] +groups = ["default", "notebooks", "trials"] files = [ {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"}, {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"}, @@ -1388,7 +1501,7 @@ name = "networkx" version = "3.3" requires_python = ">=3.10" summary = "Python package for creating and manipulating graphs and networks" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] files = [ {file = "networkx-3.3-py3-none-any.whl", hash = "sha256:28575580c6ebdaf4505b22c6256a2b9de86b316dc63ba9e93abde3d78dfdbcf2"}, {file = "networkx-3.3.tar.gz", hash = "sha256:0c127d8b2f4865f59ae9cb8aafcd60b5c70f3241ebd66f7defad7c4ab90126c9"}, @@ -1413,7 +1526,7 @@ name = "numpy" version = "1.26.4" requires_python = ">=3.9" summary = "Fundamental package for array computing in Python" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] files = [ {file = "numpy-1.26.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71"}, {file = "numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef"}, @@ -1607,7 +1720,7 @@ name = "packaging" version = "24.0" requires_python = ">=3.7" summary = "Core utilities for Python packages" -groups = ["default", "notebooks", "trails", "trials"] +groups = ["default", "notebooks", "trials"] files = [ {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, @@ -1618,7 +1731,7 @@ name = "pandas" version = "2.2.2" requires_python = ">=3.9" summary = "Powerful data structures for data analysis, time series, and statistics" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] dependencies = [ "numpy>=1.23.2; python_version == \"3.11\"", "numpy>=1.26.0; python_version >= \"3.12\"", @@ -1849,6 +1962,28 @@ files = [ {file = "pure_eval-0.2.2.tar.gz", hash = "sha256:2b45320af6dfaa1750f543d714b6d1c520a1688dec6fd24d339063ce0aaa9ac3"}, ] +[[package]] +name = "py4cytoscape" +version = "1.9.0" +requires_python = ">=3.8" +summary = "Cytoscape Automation API" +groups = ["trials"] +dependencies = [ + "backoff", + "chardet", + "colorbrewer", + "colour", + "decorator", + "igraph", + "networkx", + "pandas", + "requests", +] +files = [ + {file = "py4cytoscape-1.9.0-py3-none-any.whl", hash = "sha256:7e9088832d49489406d1933596225256652c9d58f1d1ee097fea50762bd70dca"}, + {file = "py4cytoscape-1.9.0.tar.gz", hash = "sha256:ebf214c5888497ecb9db0c166f6e66123e49402522f7058fe1169b87307e8512"}, +] + [[package]] name = "pycparser" version = "2.22" @@ -1947,7 +2082,7 @@ name = "pygraphviz" version = "1.13" requires_python = ">=3.10" summary = "Python interface to Graphviz" -groups = ["trails", "trials"] +groups = ["trials"] files = [ {file = "pygraphviz-1.13.tar.gz", hash = "sha256:6ad8aa2f26768830a5a1cfc8a14f022d13df170a8f6fdfd68fd1aa1267000964"}, ] @@ -1957,7 +2092,7 @@ name = "python-dateutil" version = "2.9.0.post0" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" summary = "Extensions to the standard Python datetime module" -groups = ["default", "notebooks", "trails", "trials"] +groups = ["default", "notebooks", "trials"] dependencies = [ "six>=1.5", ] @@ -1981,7 +2116,7 @@ files = [ name = "pytz" version = "2024.1" summary = "World timezone definitions, modern and historical" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] files = [ {file = "pytz-2024.1-py2.py3-none-any.whl", hash = "sha256:328171f4e3623139da4983451950b28e95ac706e13f3f2630a879749e7a8b319"}, {file = "pytz-2024.1.tar.gz", hash = "sha256:2a29735ea9c18baf14b448846bde5a48030ed267578472d8955cd0e7443a9812"}, @@ -2103,7 +2238,7 @@ name = "referencing" version = "0.35.1" requires_python = ">=3.8" summary = "JSON Referencing + Python" -groups = ["notebooks", "trails", "trials"] +groups = ["notebooks", "trials"] dependencies = [ "attrs>=22.2.0", "rpds-py>=0.7.0", @@ -2158,7 +2293,7 @@ name = "requests" version = "2.31.0" requires_python = ">=3.7" summary = "Python HTTP for Humans." -groups = ["default", "notebooks"] +groups = ["default", "notebooks", "trials"] dependencies = [ "certifi>=2017.4.17", "charset-normalizer<4,>=2", @@ -2213,7 +2348,7 @@ name = "rpds-py" version = "0.18.1" requires_python = ">=3.8" summary = "Python bindings to Rust's persistent data structures (rpds)" -groups = ["notebooks", "trails", "trials"] +groups = ["notebooks", "trials"] files = [ {file = "rpds_py-0.18.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:6b5ff7e1d63a8281654b5e2896d7f08799378e594f09cf3674e832ecaf396ce8"}, {file = "rpds_py-0.18.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8927638a4d4137a289e41d0fd631551e89fa346d6dbcfc31ad627557d03ceb6d"}, @@ -2369,7 +2504,7 @@ name = "scikit-network" version = "0.32.1" requires_python = ">=3.8" summary = "Graph algorithms" -groups = ["trails", "trials"] +groups = ["trials"] dependencies = [ "numpy>=1.22.4", "scipy>=1.7.3", @@ -2386,7 +2521,7 @@ name = "scipy" version = "1.13.0" requires_python = ">=3.9" summary = "Fundamental algorithms for scientific computing in Python" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] dependencies = [ "numpy<2.3,>=1.22.4", ] @@ -2454,7 +2589,7 @@ name = "six" version = "1.16.0" requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" summary = "Python 2 and 3 compatibility utilities" -groups = ["default", "notebooks", "trails", "trials"] +groups = ["default", "notebooks", "trials"] files = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, @@ -2736,6 +2871,16 @@ files = [ {file = "terminado-0.18.1.tar.gz", hash = "sha256:de09f2c4b85de4765f7714688fff57d3e75bad1f909b589fde880460c753fd2e"}, ] +[[package]] +name = "texttable" +version = "1.7.0" +summary = "module to create simple ASCII tables" +groups = ["trials"] +files = [ + {file = "texttable-1.7.0-py2.py3-none-any.whl", hash = "sha256:72227d592c82b3d7f672731ae73e4d1f88cd8e2ef5b075a7a7f01a23a3743917"}, + {file = "texttable-1.7.0.tar.gz", hash = "sha256:2d2068fb55115807d3ac77a4ca68fa48803e84ebb0ee2340f858107a36522638"}, +] + [[package]] name = "thinc" version = "8.2.3" @@ -2874,7 +3019,7 @@ name = "toolz" version = "0.12.1" requires_python = ">=3.7" summary = "List processing tools and functional utilities" -groups = ["trails", "trials"] +groups = ["trials"] files = [ {file = "toolz-0.12.1-py3-none-any.whl", hash = "sha256:d22731364c07d72eea0a0ad45bafb2c2937ab6fd38a3507bf55eae8744aa7d85"}, {file = "toolz-0.12.1.tar.gz", hash = "sha256:ecca342664893f177a13dac0e6b41cbd8ac25a358e5f215316d43e2100224f4d"}, @@ -3042,7 +3187,7 @@ name = "tzdata" version = "2024.1" requires_python = ">=2" summary = "Provider of IANA time zone data" -groups = ["default", "trails", "trials"] +groups = ["default", "trials"] files = [ {file = "tzdata-2024.1-py2.py3-none-any.whl", hash = "sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252"}, {file = "tzdata-2024.1.tar.gz", hash = "sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd"}, @@ -3064,7 +3209,7 @@ name = "urllib3" version = "2.2.1" requires_python = ">=3.8" summary = "HTTP library with thread-safe connection pooling, file post, and more." -groups = ["default", "notebooks"] +groups = ["default", "notebooks", "trials"] files = [ {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, diff --git a/pyproject.toml b/pyproject.toml index 6c253a3..be30fa2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,12 @@ notebooks = [ # (Linux not tested yet). The compiler needs additional information about the location of Graphviz # files. This information is provided by extra options. # --config-setting="--global-option=build_ext" --config-setting="--global-option=-IC:\Program Files\Graphviz\include" --config-setting="--global-option=-LC:\Program Files\Graphviz\lib" -trails = [ +trials = [ "alph[graphviz]>=0.4.10", + "py4cytoscape>=1.9.0", +] +dev = [ + "cython>=3.0.10", ] [tool.ruff] diff --git a/src/lang_main/analysis/graphs.py b/src/lang_main/analysis/graphs.py index de7abe9..e1ad50d 100644 --- a/src/lang_main/analysis/graphs.py +++ b/src/lang_main/analysis/graphs.py @@ -13,6 +13,7 @@ import numpy.typing as npt from networkx import DiGraph, Graph from pandas import DataFrame +from lang_main.constants import EDGE_WEIGHT_DECIMALS from lang_main.io import load_pickle, save_pickle from lang_main.loggers import logger_graphs as logger from lang_main.types import ( @@ -105,15 +106,26 @@ def update_graph( def convert_graph_to_undirected( graph: DiGraph, logging: bool = LOGGING_DEFAULT, + cast_int: bool = False, ) -> Graph: + dtype = np.float32 + if cast_int: + dtype = np.uint32 # get adjacency matrix - adj_mat = typing.cast(DataFrame, nx.to_pandas_adjacency(G=graph, dtype=np.uint32)) - arr = typing.cast(npt.NDArray[np.uint32], adj_mat.to_numpy()) + adj_mat = typing.cast(DataFrame, nx.to_pandas_adjacency(G=graph, dtype=dtype)) + arr = typing.cast(npt.NDArray[np.float32 | np.uint32], adj_mat.to_numpy()) + if not cast_int: + arr = arr * (10**EDGE_WEIGHT_DECIMALS) + arr = np.round(arr, decimals=0) + arr = arr.astype(np.uint32) # build undirected array: adding edges of lower triangular matrix to upper one arr_upper = np.triu(arr) arr_lower = np.tril(arr) arr_lower = np.rot90(np.fliplr(arr_lower)) arr_new = arr_upper + arr_lower + if not cast_int: + arr_new = (arr_new / 10**EDGE_WEIGHT_DECIMALS).astype(np.float32) + arr_new = np.round(arr_new, decimals=EDGE_WEIGHT_DECIMALS) # assign new data and create graph adj_mat.loc[:] = arr_new # type: ignore graph_undir = typing.cast(Graph, nx.from_pandas_adjacency(df=adj_mat)) @@ -164,6 +176,7 @@ def convert_graph_to_cytoscape( } cyto_data.append(edge_data) + # TODO: add internal behaviour (if edge added check for new min/max) min_weight: int = 0 max_weight: int = 0 if weights: @@ -257,6 +270,78 @@ def filter_graph_by_node_degree( return filtered_graph +def normalise_array_linear( + array: npt.NDArray[np.float_], +) -> npt.NDArray[np.float32]: + """apply standard linear normalisation + + Parameters + ---------- + array : npt.NDArray[np.float_] + array which shall be normalised + + Returns + ------- + npt.NDArray[np.float32] + min/max normalised array + """ + arr_norm = (array - array.min()) / (array.max() - array.min()) + + return arr_norm.astype(np.float32) + + +def weight_scaling( + weights: npt.NDArray[np.float32], + a: float = 1.1, + b: float = 0.05, +) -> npt.NDArray[np.float32]: + """non-linear scaling of already normalised edge weights [0;1]: bigger weights + have smaller weight delta than smaller weights. Bigger values für parameter + `b` reinforce this effect. + Based on: + https://math.stackexchange.com/questions/4297805/exponential-function-that-passes-through-0-0-and-1-1-with-variable-slope + + With default values the range of edge weights lies approximately between [0.1; 1] + + Parameters + ---------- + weights : npt.NDArray[np.float32] + pre-normalised edge weights as 1D array + a : float, optional + factor to determine the value for edge weights with value 0 + with default approx. 0.1, by default 1.1 + b : float, optional + adjust the curvature, smaller values increase it, by default 0.05 + + Returns + ------- + npt.NDArray[np.float32] + non-linear adjusted edge weights as 1D array + """ + adjusted_weights = (b**weights - a) / (b - a) + + return np.round(adjusted_weights, decimals=EDGE_WEIGHT_DECIMALS) + + +def rescale_edge_weights( + graph: TokenGraph, +) -> TokenGraph: + graph = graph.copy() + + weights = cast(list[int], [data['weight'] for data in graph.edges.values()]) + w_log = cast(npt.NDArray[np.float32], np.log(weights, dtype=np.float32)) + weights_norm = normalise_array_linear(w_log) + weights_adjusted = weight_scaling(weights_norm) + # assign new weight values + for idx, (node_1, node_2) in enumerate(list(graph.edges)): + graph[node_1][node_2]['weight'] = weights_adjusted[idx] + + graph.rescaled_weights = True + graph.update_metadata(logging=False) + + return graph + + # ** --------------------------------------- class TokenGraph(DiGraph): def __init__( @@ -276,6 +361,8 @@ class TokenGraph(DiGraph): self._metadata_directed: dict[str, int] = {} self._undirected: Graph | None = None self._metadata_undirected: dict[str, int] = {} + # indicate rescaled weights + self.rescaled_weights: bool = False def __repr__(self) -> str: return self.__str__() @@ -350,11 +437,17 @@ class TokenGraph(DiGraph): ) -> Graph | None: if logging is None: logging = self.logging + # cast to integer edge weights only if edges were not rescaled previously + cast_int: bool = True + if self.rescaled_weights: + cast_int = False - self._undirected = convert_graph_to_undirected(graph=self, logging=logging) - self._metadata_undirected = get_graph_metadata( - graph=self._undirected, logging=logging + self._undirected = convert_graph_to_undirected( + graph=self, + logging=logging, + cast_int=cast_int, ) + self._metadata_undirected = get_graph_metadata(graph=self._undirected, logging=False) if not inplace: return self._undirected diff --git a/src/lang_main/constants.py b/src/lang_main/constants.py index 40e37f4..348bb46 100644 --- a/src/lang_main/constants.py +++ b/src/lang_main/constants.py @@ -56,6 +56,7 @@ THRESHOLD_SIMILARITY: Final[float] = CONFIG['preprocess']['threshold_similarity' # ** token analysis # ** graph postprocessing +EDGE_WEIGHT_DECIMALS: Final[int] = 4 THRESHOLD_EDGE_WEIGHT: Final[int] = CONFIG['graph_postprocessing']['threshold_edge_weight'] # ** time analysis.uniqueness THRESHOLD_UNIQUE_TEXTS: Final[int] = CONFIG['time_analysis']['uniqueness'][ diff --git a/test-notebooks/misc.ipynb b/test-notebooks/misc.ipynb index a443ffd..a357f43 100644 --- a/test-notebooks/misc.ipynb +++ b/test-notebooks/misc.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 55, + "execution_count": 1, "id": "af118d77-d87a-4687-be5b-e810a24c403e", "metadata": {}, "outputs": [ @@ -10,21 +10,40 @@ "name": "stdout", "output_type": "stream", "text": [ - "2024-06-26 13:01:06 +0000 | io:INFO | Loaded TOML config file successfully.\n" + "2024-07-03 14:30:30 +0000 | io:INFO | Loaded TOML config file successfully.\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n", + " _torch_pytree._register_pytree_node(\n", + "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n", + " warnings.warn(\n", + "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n", + " _torch_pytree._register_pytree_node(\n", + "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n", + " _torch_pytree._register_pytree_node(\n", + "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n", + " warnings.warn(\n" ] } ], "source": [ "from lang_main import io\n", + "from lang_main.analysis.graphs import rescale_edge_weights\n", "\n", "from pathlib import Path\n", "import pickle\n", - "import base64" + "import base64\n", + "\n", + "import numpy as np" ] }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 2, "id": "4256081a-6364-4e8f-8cfd-799912ca6b94", "metadata": {}, "outputs": [], @@ -35,12 +54,12 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 3, "id": "e9a92ad6-5e63-49c4-b9e7-9f81da8549fe", "metadata": {}, "outputs": [], "source": [ - "# obj = 'TK-GRAPH_POSTPROCESSING.pkl'\n", + "#obj = 'TK-GRAPH_POSTPROCESSING.pkl'\n", "obj = 'TK-GRAPH_ANALYSIS.pkl'\n", "load_pth = res_path / obj\n", "assert load_pth.exists()" @@ -48,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 4, "id": "c2421d89-ed8c-41dd-b363-ad5b5b716704", "metadata": {}, "outputs": [ @@ -56,7 +75,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "2024-06-26 13:22:38 +0000 | io:INFO | Loaded file successfully.\n" + "2024-07-03 14:30:35 +0000 | io:INFO | Loaded file successfully.\n" ] } ], @@ -66,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 5, "id": "ca25a7f2-84af-4b5e-89d6-b139fca35617", "metadata": {}, "outputs": [], @@ -76,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 6, "id": "ff7e7ab6-67d9-4a2c-b668-cf10740f7542", "metadata": {}, "outputs": [ @@ -86,7 +105,7 @@ "TokenGraph(name: TokenGraph, number of nodes: 143, number of edges: 163)" ] }, - "execution_count": 124, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -97,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 7, "id": "f0df3580-cea5-48cc-bdbc-2927dd446e1b", "metadata": {}, "outputs": [], @@ -121,16 +140,31 @@ " ),\n", "layout_fn=lambda g: layout.force_atlas_sknet(\n", " g,\n", - " n_iter=100,\n", + " n_iter=1000,\n", " gravity_factor=0.01,\n", " repulsive_factor=0.1,\n", " init_seed=42,\n", + " ),\n", + "layout_fn=lambda g: nx.nx_agraph.pygraphviz_layout(\n", + " g,\n", + " prog=\"fdp\",\n", + " args='-GK=5'\n", + " ),\n", + "layout_fn=lambda g: nx.nx_agraph.pygraphviz_layout(\n", + " g,\n", + " prog=\"sfdp\",\n", + " args='-GK=5 -Gbeautify=true -Goverlap=true'\n", + " ),\n", + "layout_fn=lambda g: nx.nx_agraph.pygraphviz_layout(\n", + " g,\n", + " prog=\"neato\",\n", + " args='-Goverlap=false'\n", " )," ] }, { "cell_type": "code", - "execution_count": 257, + "execution_count": 8, "id": "04d3d857-37cb-420e-8426-b1465d94efae", "metadata": {}, "outputs": [], @@ -139,8 +173,8 @@ " weight_attr=\"weight\",\n", " layout_fn=lambda g: nx.nx_agraph.pygraphviz_layout(\n", " g,\n", - " prog=\"fdp\",\n", - " args='-GK=5'\n", + " prog=\"sfdp\",\n", + " args='-GK=5 -Gbeautify=true -Goverlap=true'\n", " ),\n", " node_args=dict(\n", " size=alt.Size(\n", @@ -171,7 +205,17 @@ }, { "cell_type": "code", - "execution_count": 258, + "execution_count": 104, + "id": "ae68d7d6-9e95-4a99-ac41-98a294afcca2", + "metadata": {}, + "outputs": [], + "source": [ + "tkg = Gtest.copy()" + ] + }, + { + "cell_type": "code", + "execution_count": 105, "id": "64e6a5c1-e42d-4ad2-8c32-5cf62bc75852", "metadata": {}, "outputs": [], @@ -185,7 +229,7 @@ }, { "cell_type": "code", - "execution_count": 259, + "execution_count": 106, "id": "7e895f70-74a2-433c-91c2-a440303ab81a", "metadata": {}, "outputs": [], @@ -195,87 +239,26 @@ }, { "cell_type": "code", - "execution_count": 260, + "execution_count": 107, "id": "a13cc710-01d8-4f52-b066-3796b4609118", "metadata": {}, "outputs": [ { - "data": { - "text/html": [ - "\n", - "\n", - "
\n", - "" - ], - "text/plain": [ - "alt.LayerChart(...)" - ] - }, - "execution_count": 260, - "metadata": {}, - "output_type": "execute_result" + "ename": "TypeError", + "evalue": "decoding to str: need a bytes-like object, NoneType found", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[107], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43malph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtkg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43malph_params\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mconfigure_view(strokeWidth\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m)\n", + "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\alph\\core.py:195\u001b[0m, in \u001b[0;36malph\u001b[1;34m(G, weight_attr, layout_fn, node_args, edge_args, combo_group_by, combo_node_additional_attrs, combo_layout_fn, combo_node_args, combo_edge_args, combo_empty_attr_action, combo_size_scale_domain, combo_size_scale_range, combo_inner_graph_scale_factor, combo_edge_weight_agg_attr, combo_edge_agg_attrs, combo_edge_weight_threshold, include_edgeless_combo_nodes, non_serializable_datetime_format, width, height, prop_kwargs, padding, nodes_layer_params)\u001b[0m\n\u001b[0;32m 193\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 194\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m layout_fn:\n\u001b[1;32m--> 195\u001b[0m pos \u001b[38;5;241m=\u001b[39m \u001b[43mlayout_fn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mG\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 196\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 197\u001b[0m pos \u001b[38;5;241m=\u001b[39m layout\u001b[38;5;241m.\u001b[39mdefault_network_layout(G, weight_attr\u001b[38;5;241m=\u001b[39mweight_attr)\n", + "Cell \u001b[1;32mIn[66], line 3\u001b[0m, in \u001b[0;36m\u001b[1;34m(g)\u001b[0m\n\u001b[0;32m 1\u001b[0m alph_params \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mdict\u001b[39m(\n\u001b[0;32m 2\u001b[0m weight_attr\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mweight\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m----> 3\u001b[0m layout_fn\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m g: \u001b[43mnx\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnx_agraph\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpygraphviz_layout\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mg\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mprog\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43msfdp\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[0;32m 6\u001b[0m \u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m-GK=5 -Gbeautify=true -Goverlap=true\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\n\u001b[0;32m 7\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m,\n\u001b[0;32m 8\u001b[0m node_args\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mdict\u001b[39m(\n\u001b[0;32m 9\u001b[0m size\u001b[38;5;241m=\u001b[39malt\u001b[38;5;241m.\u001b[39mSize(\n\u001b[0;32m 10\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdegree_centrality\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 11\u001b[0m scale\u001b[38;5;241m=\u001b[39malt\u001b[38;5;241m.\u001b[39mScale(domain\u001b[38;5;241m=\u001b[39m[\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m1\u001b[39m], \u001b[38;5;28mrange\u001b[39m\u001b[38;5;241m=\u001b[39m[\u001b[38;5;241m12\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m40\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m2\u001b[39m]),\n\u001b[0;32m 12\u001b[0m legend\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 13\u001b[0m ),\n\u001b[0;32m 14\u001b[0m \u001b[38;5;66;03m#fill=alt.Color(\u001b[39;00m\n\u001b[0;32m 15\u001b[0m \u001b[38;5;66;03m# \"degree_centrality\",\u001b[39;00m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;66;03m# scale=alt.Scale(domain=companies, range=palette),\u001b[39;00m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;66;03m#),\u001b[39;00m\n\u001b[0;32m 18\u001b[0m stroke\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m#333\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 19\u001b[0m strokeWidth\u001b[38;5;241m=\u001b[39malt\u001b[38;5;241m.\u001b[39mSize(\n\u001b[0;32m 20\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdegree_centrality\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 21\u001b[0m scale\u001b[38;5;241m=\u001b[39malt\u001b[38;5;241m.\u001b[39mScale(domain\u001b[38;5;241m=\u001b[39m[\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m1\u001b[39m], \u001b[38;5;28mrange\u001b[39m\u001b[38;5;241m=\u001b[39m[\u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m5\u001b[39m]),\n\u001b[0;32m 22\u001b[0m legend\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 23\u001b[0m ),\n\u001b[0;32m 24\u001b[0m tooltip_attrs\u001b[38;5;241m=\u001b[39m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[0;32m 25\u001b[0m label_attr\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mid\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 26\u001b[0m ),\n\u001b[0;32m 27\u001b[0m edge_args\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mdict\u001b[39m(\n\u001b[0;32m 28\u001b[0m color\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m#000\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 29\u001b[0m ),\n\u001b[0;32m 30\u001b[0m width\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m800\u001b[39m,\n\u001b[0;32m 31\u001b[0m height\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m600\u001b[39m,\n\u001b[0;32m 32\u001b[0m )\n", + "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\networkx\\drawing\\nx_agraph.py:307\u001b[0m, in \u001b[0;36mpygraphviz_layout\u001b[1;34m(G, prog, root, args)\u001b[0m\n\u001b[0;32m 305\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m root \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 306\u001b[0m args \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m-Groot=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mroot\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m--> 307\u001b[0m A \u001b[38;5;241m=\u001b[39m \u001b[43mto_agraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mG\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 308\u001b[0m A\u001b[38;5;241m.\u001b[39mlayout(prog\u001b[38;5;241m=\u001b[39mprog, args\u001b[38;5;241m=\u001b[39margs)\n\u001b[0;32m 309\u001b[0m node_pos \u001b[38;5;241m=\u001b[39m {}\n", + "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\networkx\\drawing\\nx_agraph.py:159\u001b[0m, in \u001b[0;36mto_agraph\u001b[1;34m(N)\u001b[0m\n\u001b[0;32m 157\u001b[0m \u001b[38;5;66;03m# add nodes\u001b[39;00m\n\u001b[0;32m 158\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m n, nodedata \u001b[38;5;129;01min\u001b[39;00m N\u001b[38;5;241m.\u001b[39mnodes(data\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[1;32m--> 159\u001b[0m \u001b[43mA\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_node\u001b[49m\u001b[43m(\u001b[49m\u001b[43mn\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 160\u001b[0m \u001b[38;5;66;03m# Add node data\u001b[39;00m\n\u001b[0;32m 161\u001b[0m a \u001b[38;5;241m=\u001b[39m A\u001b[38;5;241m.\u001b[39mget_node(n)\n", + "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pygraphviz\\agraph.py:338\u001b[0m, in \u001b[0;36mAGraph.add_node\u001b[1;34m(self, n, **attr)\u001b[0m\n\u001b[0;32m 336\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n\u001b[0;32m 337\u001b[0m nh \u001b[38;5;241m=\u001b[39m gv\u001b[38;5;241m.\u001b[39magnode(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandle, n, _Action\u001b[38;5;241m.\u001b[39mcreate)\n\u001b[1;32m--> 338\u001b[0m node \u001b[38;5;241m=\u001b[39m \u001b[43mNode\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnh\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnh\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 339\u001b[0m node\u001b[38;5;241m.\u001b[39mattr\u001b[38;5;241m.\u001b[39mupdate(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mattr)\n", + "File \u001b[1;32mA:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\pygraphviz\\agraph.py:1861\u001b[0m, in \u001b[0;36mNode.__new__\u001b[1;34m(self, graph, name, nh)\u001b[0m\n\u001b[0;32m 1859\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__new__\u001b[39m(\u001b[38;5;28mself\u001b[39m, graph, name\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, nh\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m 1860\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m nh \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m-> 1861\u001b[0m n \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__new__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mgv\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43magnameof\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnh\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mgraph\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencoding\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1862\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 1863\u001b[0m n \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__new__\u001b[39m(\u001b[38;5;28mself\u001b[39m, name)\n", + "\u001b[1;31mTypeError\u001b[0m: decoding to str: need a bytes-like object, NoneType found" + ] } ], "source": [ @@ -284,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 261, + "execution_count": 65, "id": "842e01fa-29cd-4028-9461-c7af24e01c33", "metadata": {}, "outputs": [ @@ -294,7 +277,7 @@ "{'id': 'Wartungstätigkeit', 'degree_centrality': 0.04225352112676056}" ] }, - "execution_count": 261, + "execution_count": 65, "metadata": {}, "output_type": "execute_result" } @@ -311,10 +294,503 @@ "outputs": [], "source": [] }, + { + "cell_type": "markdown", + "id": "14efa0e8-0937-44da-a76c-160829a7e9bf", + "metadata": {}, + "source": [ + "**additional info:**\n", + "- overlap removal for sfdp Graphviz algorithm not available because of missing triangulation library (only available on Linux)" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "7f6d1b73-7378-4c98-aeed-b72bf27a942e", + "id": "bfc0f3a7-8865-4b44-bd9c-2c3f4ff9e70e", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "1e61aca3-efea-4e38-8174-5ca4b2585256", + "metadata": {}, + "outputs": [], + "source": [ + "obj = 'TK-GRAPH_POSTPROCESSING.pkl'\n", + "# obj = 'TK-GRAPH_ANALYSIS.pkl'\n", + "load_pth = res_path / obj\n", + "assert load_pth.exists()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "5d83c04c-03ab-4086-a4e9-ae430e4c6090", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2024-07-03 14:30:35 +0000 | io:INFO | Loaded file successfully.\n" + ] + } + ], + "source": [ + "ret = io.load_pickle(load_pth)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "4718b54e-0891-4f70-8c67-90c439bc8bfd", + "metadata": {}, + "outputs": [], + "source": [ + "tkg = ret[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "ddcb4ff0-eac4-45ba-9c6e-83ada4b0276c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "TokenGraph(name: TokenGraph, number of nodes: 6028, number of edges: 17950)" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tkg" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "97c46ca7-ca9f-4d11-8d86-cfbd819b7573", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "f6fc2c6a-2171-411d-92f1-4ab694adda7b", + "metadata": {}, + "outputs": [], + "source": [ + "Gtest = rescale_edge_weights(tkg)" + ] + }, + { + "cell_type": "markdown", + "id": "859be6a3-a919-433a-a0a7-f4d74cdc6bf7", + "metadata": {}, + "source": [ + "break_early = False\n", + "i = 0\n", + "for idx, (node1, node2) in enumerate(list(Gtest.edges)):\n", + " if break_early and i == 10:\n", + " break\n", + " Gtest[node1][node2]['weight'] = adjusted_weights[idx]\n", + " \n", + " i += 1" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "f381b25a-6149-4a2a-876c-4cbd8bb9bd04", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wartungstätigkeit Vorgabe 1.0\n", + "Wartungstätigkeit Maschinenhersteller 1.0\n", + "Wartungstätigkeit Maschinenbediener 0.8215\n", + "Wartungstätigkeit Laserabteilung 0.8215\n", + "Wartungstätigkeit Arbeitsplan 0.8219\n", + "Wartungstätigkeit abarbeiten 0.8215\n", + "Wartungstätigkeit Webmaschinenkontrollliste 0.2534\n", + "Wartungstätigkeit sehen 0.2534\n", + "Vorgabe Maschinenhersteller 1.0\n", + "Vorgabe Wartungsplan 0.9181\n" + ] + } + ], + "source": [ + "break_early = True\n", + "i = 0\n", + "for n1, n2, w in Gtest.edges.data('weight'):\n", + " if break_early and i == 10:\n", + " break\n", + " print(n1, n2, w)\n", + "\n", + " i += 1" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "c45a8136-2a81-4ede-a087-cf86ce85d939", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2024-07-03 14:30:39 +0000 | graphs:INFO | Successfully converted graph to one with undirected edges.\n", + "2024-07-03 14:30:39 +0000 | graphs:INFO | Graph properties: 6028 Nodes, 17554 Edges\n", + "2024-07-03 14:30:39 +0000 | graphs:INFO | Node memory: 373.36 KB\n", + "2024-07-03 14:30:39 +0000 | graphs:INFO | Edge memory: 959.98 KB\n", + "2024-07-03 14:30:39 +0000 | graphs:INFO | Total memory: 1333.34 KB\n" + ] + } + ], + "source": [ + "Gtest.to_undirected(inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "303d8d0c-9320-4739-adf6-ac9ba82731de", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "a7929935-3bd2-4eb8-907c-4d37251f11ea", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Wartungstätigkeit Vorgabe 1.0\n", + "Wartungstätigkeit Maschinenhersteller 1.0\n", + "Wartungstätigkeit sehen 0.2533999979496002\n", + "Wartungstätigkeit Maschinenbediener 0.8215000033378601\n", + "Wartungstätigkeit Laserabteilung 0.8215000033378601\n", + "Wartungstätigkeit Arbeitsplan 0.8219000101089478\n", + "Wartungstätigkeit abarbeiten 0.8215000033378601\n", + "Wartungstätigkeit Webmaschinenkontrollliste 0.2533999979496002\n", + "Vorgabe Maschinenhersteller 1.0\n", + "Vorgabe Wartungsplan 0.9180999994277954\n" + ] + } + ], + "source": [ + "break_early = True\n", + "i = 0\n", + "for n1, n2, w in Gtest.undirected.edges.data('weight'):\n", + " if break_early and i == 10:\n", + " break\n", + " print(n1, n2, w)\n", + "\n", + " i += 1" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "4df89d59-3832-4b6d-9eae-b3220b6f7e5b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'num_nodes': 6028,\n", + " 'num_edges': 17554,\n", + " 'min_edge_weight': 0.09520000219345093,\n", + " 'max_edge_weight': 1.7527999877929688,\n", + " 'node_memory': 382321,\n", + " 'edge_memory': 983024,\n", + " 'total_memory': 1365345}" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Gtest.metadata_undirected" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "adf02de4-f22c-499f-91bf-ac1be1b3186f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'num_nodes': 6028,\n", + " 'num_edges': 17950,\n", + " 'min_edge_weight': 0.0952,\n", + " 'max_edge_weight': 1.0,\n", + " 'node_memory': 382321,\n", + " 'edge_memory': 1005200,\n", + " 'total_memory': 1387521}" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Gtest.metadata_directed" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e939c9c-ba9e-4576-9d85-afba8481af93", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "bfafdc8b-418d-4dd8-b986-d36082ba870e", + "metadata": {}, + "outputs": [], + "source": [ + "c_comps = nx.connected_components(Gtest.undirected)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "abf5603d-dab9-49a0-8c86-d2429a36d24d", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5714\n", + "2\n", + "2\n", + "2\n", + "3\n", + "4\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "3\n", + "4\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "3\n", + "2\n", + "2\n", + "4\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "4\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "4\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n", + "3\n", + "3\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "2\n", + "3\n", + "2\n", + "2\n", + "2\n" + ] + } + ], + "source": [ + "for comp in c_comps:\n", + " print(len(comp))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "80db8d16-fa48-417d-91b0-37e5b32f3b74", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2e2cbbe-68ef-4ea0-9ed0-b114be1efd08", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "fcd9247f-c4f9-4f73-9fd3-2ab56700073f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You are connected to Cytoscape!\n" + ] + }, + { + "data": { + "text/plain": [ + "{'apiVersion': 'v1',\n", + " 'cytoscapeVersion': '3.10.2',\n", + " 'automationAPIVersion': '1.9.0',\n", + " 'py4cytoscapeVersion': '1.9.0'}" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import py4cytoscape as py4\n", + "dir(py4)\n", + "py4.cytoscape_ping()\n", + "py4.cytoscape_version_info()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b9290659-e33c-47fc-8d89-7aa3dd6e843a", "metadata": {}, "outputs": [], "source": []