Package: pynauty
PynautyPynauty can be used to compare graphs for isomorphism and to determine
their automorphism group in a Python programming environment.  Pynauty
is a Python/C extension module using library components from theNautypackage by Brendan McKay.Current version is distributed and has been tested withnauty2_8_6.UsageHere is an example ofpynauty's usage in an interactive session.>>>frompynautyimport*>>>g=Graph(5)>>>g.connect_vertex(0,[1,2,3])>>>g.connect_vertex(2,[1,3,4])>>>g.connect_vertex(4,[3])>>>print(g)Graph(number_of_vertices=5,directed=False,adjacency_dict={0:[1,2,3],2:[1,3,4],4:[3],},vertex_coloring=[],)>>>autgrp(g)([[3,4,2,0,1]],2.0,0,[0,1,2,0,1],3)>>>>>>g.connect_vertex(1,[3])>>>autgrp(g)([[0,1,3,2,4],[1,0,2,3,4]],4.0,0,[0,0,2,2,4],3)>>>>>>g.set_vertex_coloring([set([3])])>>>print(g)Graph(number_of_vertices=5,directed=False,adjacency_dict={0:[1,2,3],1:[3],2:[1,3,4],4:[3],},vertex_coloring=[set([3]),set([0,1,2,4]),],)>>>autgrp(g)([[1,0,2,3,4]],2.0,0,[0,0,2,3,4],4)>>>Please note that multigraphs are not supported, but this limitation can be
worked around by encoding multigraphs as simple graphs. For details, see the
documentation and Nauty's manual.InstallationInstalling fromPyPiYou can installpynautyusingpip, just typepipinstall--upgradepynautyMany binary wheels are provided for recent Linux and macOS systems.
When your system is not compatible with any of the provided binary
wheelspipattempts to build the wheel of the extension module in your
local system. This happens automatically and the process is transparent
to the user.  For local buildspipexpects that therequired
toolsare available.You can force the local (re)compilation during install by issuingpipinstall--no-binarypynautypynautyRegardless of which way the installation was accomplished, afterwards
you can test the result by running the provided tests.python<path-to-installed-package>/pynauty/tests/test_minimal.pyIf you havepytestinstalled then you can run the full test suit by
issuingpipinstallpytest
python-mpytest<path-to-installed-package>/pynautyThat takes a few seconds but then you can be sure in having a binary
compatible module.DocumentationThepynautypackage comes with an HTML documentation with examples.
You can read it with your favorite browser:<your-browser><path-to-installed-package>/pynauty/docs/html/index.htmlBuilding manually from sourcesRequirementsApart from Python the requirements are the same as for building Nauty.Python 3.8 - 3.10An ANSI C compilerGNU makeDownload sourcesYou can download the source distribution formPyPiby issuing:pipdownload--no-binarypynautypynautyPlease note, the source distribution also contains Nauty2_8_6's source.Build, test, installIf you really are interested in the low level details then unpack the
downloaded source distribution, change intopynauty's directory and
typemake.  The Makefile is self-documenting in the sense that
invokingmakewithout arguments will list all available targets with
short explanations.ContributingQuestions, bug reports, pull requests, especially the ones extending the
Python module's functionality, are welcome. Please, open an issue first
to discuss what you would like to change.Pull requests must be made on a dedicatedtopic-branchof your choice
and not againstupstream/main.  Before submitting a pull request, make
sure that your fork is up to date with upstream. Also update tests,
documentation, examples as appropriate with the changes in your PR.Contributors@goens helped creatingpytestcomponents.Sam Morley-Short (@sammorley-short) addedcanon_label()function.Frank Bryce fixed the issue of misleadingly accepting multigraphs.LicensePynauty is distributed under the terms of GPL v3 WITHOUT ANY WARRANTY.
For the exact details on licensing see the fileCOPYING.Please note, Nauty is covered by its own licensing terms. For the exact
details see the filesrc/nauty2_8_6/COPYRIGHT.