{"id":27228,"library":"passagemath-rankwidth","title":"passagemath-rankwidth","description":"passagemath-rankwidth provides functions for computing rankwidth and rank decompositions of graphs using the rw library. Part of the passagemath ecosystem. Current version: 10.8.4, released as part of passagemath 10.8. Release cadence follows passagemath releases (roughly 2-3 per year).","status":"active","version":"10.8.4","language":"python","source_language":"en","source_url":"https://github.com/passagemath/passagemath-rankwidth","tags":["graph theory","rankwidth","rank decomposition","passagemath","rw"],"install":[{"cmd":"pip install passagemath-rankwidth","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core passagemath environment; required for graph objects and rankwidth functionality","package":"passagemath-sage","optional":false},{"reason":"Additional combinatorial structures used in rank decomposition","package":"passagemath-combinat","optional":true}],"imports":[{"note":"The old sage namespace is not available in passagemath; use passagemath prefix.","wrong":"from sage.graphs.rankwidth import rankwidth","symbol":"rankwidth","correct":"from passagemath.graphs.rankwidth import rankwidth"}],"quickstart":{"code":"from passagemath.graphs.rankwidth import rankwidth\ng = graphs.PetersenGraph()\nrw, decomp = rankwidth(g, algorithm='rw')\nprint(rw)","lang":"python","description":"Compute the rankwidth of the Petersen graph using the rw algorithm."},"warnings":[{"fix":"Use 'from passagemath.graphs.rankwidth import rankwidth' instead.","message":"The import path has changed from sage.graphs.rankwidth to passagemath.graphs.rankwidth. Old imports will fail.","severity":"breaking","affected_versions":">=10.8"},{"fix":"Install the rw library (e.g., on Debian/Ubuntu: apt-get install rw) or set algorithm='cunningham' for a pure Python implementation.","message":"The rw algorithm (the default) uses the external 'rw' library, which must be installed as a system dependency. pip install does not install it automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Use algorithm='cunningham' instead of algorithm='exact'.","message":"The 'algorithm' parameter 'exact' is deprecated in favor of 'cunningham' for the exact decomposition method.","severity":"deprecated","affected_versions":">=10.8"},{"fix":"Access the rankwidth as the first element, and the decomposition as the second.","message":"The function returns a tuple (rankwidth, decomposition). The decomposition is a linear ordering representation, not a tree. Do not expect a tree structure.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install passagemath-rankwidth' and ensure you use the correct import path: from passagemath.graphs.rankwidth import rankwidth","cause":"The package passagemath-rankwidth is not installed or not properly imported.","error":"ModuleNotFoundError: No module named 'passagemath.graphs.rankwidth'"},{"fix":"Use 'rw' or 'cunningham' (the latter replaces the deprecated 'exact').","cause":"You passed an invalid algorithm string.","error":"ValueError: algorithm must be one of 'rw', 'cunningham', 'exact'"},{"fix":"Install rw (e.g., sudo apt install rw) or use algorithm='cunningham'.","cause":"The external 'rw' library is not installed on the system.","error":"RuntimeError: rw executable not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}