├── tst ├── out │ └── .empty ├── github_actions │ ├── install.g │ ├── examples.g │ ├── extreme.g │ └── standard.g ├── teststandard.g ├── testall.g ├── extreme │ ├── cliques.tst │ └── named.tst ├── workspaces │ ├── load-workspace.tst │ └── save-workspace.tst └── standard │ └── orbits.tst ├── .VERSION ├── .gitattributes ├── data ├── tourn4.txt ├── graph5.g6.gz ├── boolean_row_spaces.d6.gz ├── symmetric-closure.ds6.gz └── tree9.4.txt ├── doc ├── m3.png ├── n5.png ├── digraphs.css ├── z-chap3.xml ├── z-chap5.xml ├── utils.xml └── z-chap6.xml ├── etc ├── cpplint.sh ├── gaplint.sh ├── tst-local-vars.py └── tst-unbind-local-vars.py ├── .gaplint.yml ├── extern ├── edge-addition-planarity-suite-Version_4.0.0.0 │ ├── c │ │ ├── .gdbinit │ │ ├── samples │ │ │ ├── nauty_example.LEDA │ │ │ └── Makefile.am │ │ ├── graphLib │ │ │ ├── homeomorphSearch │ │ │ │ ├── graphK4Search.h │ │ │ │ ├── graphK23Search.h │ │ │ │ ├── graphK33Search.h │ │ │ │ ├── graphK23Search.private.h │ │ │ │ ├── graphK33Search.private.h │ │ │ │ └── graphK4Search.private.h │ │ │ ├── io │ │ │ │ ├── g6-api-utilities.h │ │ │ │ ├── g6-api-utilities.c │ │ │ │ ├── strOrFile.h │ │ │ │ ├── g6-read-iterator.h │ │ │ │ ├── strbuf.h │ │ │ │ └── g6-write-iterator.h │ │ │ ├── planarityRelated │ │ │ │ ├── graphDrawPlanar.h │ │ │ │ └── graphDrawPlanar.private.h │ │ │ ├── extensionSystem │ │ │ │ ├── graphExtensions.private.h │ │ │ │ ├── graphExtensions.h │ │ │ │ └── graphFunctionTable.h │ │ │ ├── lowLevelUtils │ │ │ │ ├── apiutils.h │ │ │ │ ├── apiutils.c │ │ │ │ ├── platformTime.h │ │ │ │ └── appconst.h │ │ │ └── graphLib.h │ │ ├── graphLib.h │ │ ├── planarityApp │ │ │ ├── planarity.c │ │ │ ├── planarity.h │ │ │ └── planarityTransformGraph.c │ │ └── graph.h │ ├── .gitattributes │ ├── .editorconfig │ ├── test-samples.sh.in │ ├── libplanarity.pc.in │ ├── TestSupport │ │ ├── generate_graphs.bat │ │ ├── planarity_runner.bat │ │ └── planaritytesting │ │ │ └── __init__.py │ ├── devEnvSetupAndDefaults │ │ ├── .vscode │ │ │ └── settings.json │ │ ├── devEnvSetup.sh │ │ └── TestSupport │ │ │ └── planaritytesting │ │ │ └── leaksorchestrator │ │ │ └── planarity_leaks_config.ini │ ├── configure.ac │ ├── .gitignore │ ├── LICENSE.TXT │ └── Makefile.am ├── eaps_flags.h └── bliss-0.73 │ ├── timer.hh │ ├── defs.cc │ ├── timer.cc │ ├── heap.cc │ ├── uintseqhash.hh │ ├── utils.hh │ ├── heap.hh │ ├── utils.cc │ ├── orbit.cc │ ├── .clang-format │ ├── kstack.hh │ └── bignum.hh ├── autogen.sh ├── src ├── CPPLINT.cfg ├── safemalloc.h ├── cliques.h ├── globals.h ├── homos.h ├── safemalloc.c ├── planar.h ├── gap-includes.h ├── digraphs-debug.h ├── digraphs.h ├── bliss-includes.h ├── schreier-sims.h ├── conditions.c ├── perms.c ├── .clang-format ├── homos-graphs.h └── perms.h ├── .codespellrc ├── release.toml ├── .github ├── workflows │ ├── codespell.yml │ ├── lint.yml │ ├── manual.yml │ ├── valgrind.yml │ ├── release.yml │ └── ubuntu.yml └── dependabot.yml ├── Dockerfile ├── LICENSE ├── .gitignore ├── .codecov.yml ├── gap ├── constructors.gd ├── orbits.gd ├── utils.gd ├── display.gd ├── grape.gd ├── planar.gd ├── labels.gd ├── digraphs.g ├── cliques.gd ├── weights.gd ├── io.gd └── isomorph.gd ├── m4 ├── ax_check_bliss.m4 ├── ax_require_defined.m4 ├── ax_check_planarity.m4 ├── ax_append_flag.m4 ├── ax_append_compile_flags.m4 ├── ax_check_compile_flag.m4 └── find_gap.m4 ├── read.g ├── VERSIONS └── init.g /tst/out/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.VERSION: -------------------------------------------------------------------------------- 1 | 1.13.1 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /data/tourn4.txt: -------------------------------------------------------------------------------- 1 | 000000 2 | 000101 3 | 100010 4 | 100100 5 | -------------------------------------------------------------------------------- /doc/m3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digraphs/Digraphs/HEAD/doc/m3.png -------------------------------------------------------------------------------- /doc/n5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digraphs/Digraphs/HEAD/doc/n5.png -------------------------------------------------------------------------------- /etc/cpplint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cpplint src/*.[ch] 5 | -------------------------------------------------------------------------------- /.gaplint.yml: -------------------------------------------------------------------------------- 1 | disable: 2 | - align-assignments 3 | dupl-func-min-len: 4 4 | -------------------------------------------------------------------------------- /data/graph5.g6.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digraphs/Digraphs/HEAD/data/graph5.g6.gz -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/.gdbinit: -------------------------------------------------------------------------------- 1 | set new-console on 2 | -------------------------------------------------------------------------------- /data/boolean_row_spaces.d6.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digraphs/Digraphs/HEAD/data/boolean_row_spaces.d6.gz -------------------------------------------------------------------------------- /data/symmetric-closure.ds6.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digraphs/Digraphs/HEAD/data/symmetric-closure.ds6.gz -------------------------------------------------------------------------------- /etc/gaplint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | gaplint --disable W004 $@ *.g gap/* doc/*.xml tst/testinstall.tst tst/standard/*.tst tst/extreme/*.tst tst/workspaces/*.tst 5 | -------------------------------------------------------------------------------- /tst/github_actions/install.g: -------------------------------------------------------------------------------- 1 | LoadPackage("digraphs", false);; 2 | if DigraphsTestInstall() then 3 | QUIT_GAP(0); 4 | else 5 | QUIT_GAP(1); 6 | fi; 7 | FORCE_QUIT_GAP(1); 8 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Regenerate configure from configure.ac. Requires GNU autoconf. 4 | set -ex 5 | mkdir -p gen 6 | aclocal -Wall --force 7 | autoconf -Wall -f 8 | autoheader -Wall -f 9 | -------------------------------------------------------------------------------- /tst/github_actions/examples.g: -------------------------------------------------------------------------------- 1 | LoadPackage("digraphs", false);; 2 | if DIGRAPHS_RunTest(DigraphsTestManualExamples) then 3 | QUIT_GAP(0); 4 | else 5 | QUIT_GAP(1); 6 | fi; 7 | FORCE_QUIT_GAP(1); 8 | -------------------------------------------------------------------------------- /tst/github_actions/extreme.g: -------------------------------------------------------------------------------- 1 | LoadPackage("digraphs", false);; 2 | if DigraphsTestExtreme(rec(earlyStop := false)) then 3 | QUIT_GAP(0); 4 | else 5 | QUIT_GAP(1); 6 | fi; 7 | FORCE_QUIT_GAP(1); 8 | -------------------------------------------------------------------------------- /tst/github_actions/standard.g: -------------------------------------------------------------------------------- 1 | LoadPackage("digraphs", false);; 2 | if DigraphsTestStandard(rec(earlyStop := false)) then 3 | QUIT_GAP(0); 4 | else 5 | QUIT_GAP(1); 6 | fi; 7 | FORCE_QUIT_GAP(1); 8 | -------------------------------------------------------------------------------- /doc/digraphs.css: -------------------------------------------------------------------------------- 1 | /* digraphs.css: Digraphs-specific styles appended to manual.css by DigraphsMakeDoc */ 2 | 3 | figure { 4 | text-align: center; 5 | } 6 | 7 | figcaption { 8 | margin: 1em 0; 9 | } 10 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/.gitattributes: -------------------------------------------------------------------------------- 1 | # From https://stackoverflow.com/a/42136008 2 | # See also https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings 3 | * text=auto eol=lf 4 | -------------------------------------------------------------------------------- /src/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | filter=-build/include_subdir,-runtime/indentation_namespace,-runtime/references, -readability/casting,-runtime/threadsafe_fn,-runtime/int,-readability/todo 3 | linelength=80 4 | root=../.. 5 | exclude_files=(pkgconfig.h|digraphs-config.h) 6 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/samples/nauty_example.LEDA: -------------------------------------------------------------------------------- 1 | LEDA.GRAPH 2 | void 3 | void 4 | -2 5 | 6 | 5 7 | |{v1}| 8 | |{v2}| 9 | |{v3}| 10 | |{v4}| 11 | |{v5}| 12 | 13 | 4 14 | 1 3 0 |{}| 15 | 1 5 0 |{}| 16 | 2 4 0 |{}| 17 | 4 5 0 |{}| 18 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | skip = ./.git,./tmp,./data,./extern,./tst,./bin,./libtool,configure,configure~,./gh-pages,./autom4te.cache,./cnf,aclocal.m4,./m4,./doc/*.log,./doc/*.html,./doc/*.txt,./doc/*.six,./doc/*.js,./doc/*.bbl,./doc/*.tex,./doc/*.bib 3 | ignore-words-list=ist,manuel,MIS,mis,homs 4 | -------------------------------------------------------------------------------- /release.toml: -------------------------------------------------------------------------------- 1 | [authors] 2 | expired_emails = [ 3 | "cr66@st-andrews.ac.uk", 4 | "GrahamCampbell@users.noreply.github.com", 5 | "47450781+RaiyanC@users.noreply.github.com", 6 | "al319@st-andrews.ac.uk" 7 | ] 8 | author_files = ["PackageInfo.g"] 9 | ignore = ["convert-repo", "dependabot", "Luke"] 10 | -------------------------------------------------------------------------------- /.github/workflows/codespell.yml: -------------------------------------------------------------------------------- 1 | name: Codespell 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | - stable-*.* 9 | jobs: 10 | codespell: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v5 14 | - uses: codespell-project/actions-codespell@v2 15 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/.editorconfig: -------------------------------------------------------------------------------- 1 | # From https://stackoverflow.com/a/42136008 2 | # EditorConfig is awesome: http://EditorConfig.org 3 | 4 | # top-most EditorConfig file 5 | root = true 6 | 7 | # Unix-style newlines with a newline ending every file 8 | [*] 9 | end_of_line = lf 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/test-samples.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Run "planarity -test" using planarity from the build tree and the 4 | # samples from the source tree. 5 | # 6 | 7 | samplesdir="@abs_top_srcdir@/c/samples" 8 | planaritydir="@abs_top_builddir@" 9 | 10 | cd "${planaritydir}" || exit 1 11 | ./planarity -test "${samplesdir}" || exit 2 12 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/libplanarity.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE_NAME@ 7 | URL: https://github.com/graph-algorithms/edge-addition-planarity-suite 8 | Description: Edge Addition Planarity Suite Graph Library 9 | Version: @PACKAGE_VERSION@ 10 | Libs: -L${libdir} -lplanarity 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /data/tree9.4.txt: -------------------------------------------------------------------------------- 1 | 0 7 0 8 1 7 2 8 3 8 4 8 5 8 6 8 2 | 0 7 0 8 1 7 2 7 3 8 4 8 5 8 6 8 3 | 0 7 0 8 1 7 2 7 3 7 4 8 5 8 6 8 4 | 0 6 0 8 1 7 1 8 2 8 3 8 4 8 5 8 5 | 0 6 0 7 0 8 1 7 2 8 3 8 4 8 5 8 6 | 0 6 0 8 1 7 2 7 3 8 4 8 5 8 7 8 7 | 0 6 0 7 0 8 1 7 2 7 3 8 4 8 5 8 8 | 0 6 0 8 1 7 2 7 3 7 4 8 5 8 7 8 9 | 0 6 0 7 0 8 1 6 2 7 3 8 4 8 5 8 10 | 0 6 1 6 2 7 3 7 4 8 5 8 6 8 7 8 11 | 0 5 0 8 1 6 1 8 2 7 2 8 3 8 4 8 12 | 0 5 0 8 1 6 1 8 2 7 3 7 4 8 7 8 13 | 0 5 0 8 1 6 2 6 3 7 4 7 6 8 7 8 14 | 0 4 0 8 1 5 1 8 2 6 2 8 3 7 3 8 15 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK4Search.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K4SEARCH_H 2 | #define GRAPH_K4SEARCH_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graphStructures.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | #define K4SEARCH_NAME "K4Search" 18 | 19 | int gp_AttachK4Search(graphP theGraph); 20 | int gp_DetachK4Search(graphP theGraph); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK23Search.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K23SEARCH_H 2 | #define GRAPH_K23SEARCH_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graphStructures.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | #define K23SEARCH_NAME "K23Search" 18 | 19 | int gp_AttachK23Search(graphP theGraph); 20 | int gp_DetachK23Search(graphP theGraph); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK33Search.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K33SEARCH_H 2 | #define GRAPH_K33SEARCH_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graphStructures.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | #define K33SEARCH_NAME "K33Search" 18 | 19 | int gp_AttachK33Search(graphP theGraph); 20 | int gp_DetachK33Search(graphP theGraph); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERSTUB_GRAPHLIB_H 2 | #define HELPERSTUB_GRAPHLIB_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | // NOTE: This helper stub has been added to make it easier for downstream 11 | // consumers to obtain access to all features in the graph library of 12 | // the planarity project. 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif 18 | 19 | #include "c/graphLib/graphLib.h" 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/g6-api-utilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #ifndef G6_API_UTILITIES 8 | #define G6_API_UTILITIES 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | int _getMaxEdgeCount(int); 16 | int _getNumCharsForGraphEncoding(int); 17 | int _getNumCharsForGraphOrder(int); 18 | int _getExpectedNumPaddingZeroes(const int, const int); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif /* G6_API_UTILITIES */ 25 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK23Search.private.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K23SEARCH_PRIVATE_H 2 | #define GRAPH_K23SEARCH_PRIVATE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graph.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | typedef struct 18 | { 19 | // Overloaded function pointers 20 | graphFunctionTable functions; 21 | 22 | } K23SearchContext; 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/safemalloc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | *A safemalloc.h Safer memory allocation 4 | ** 5 | ** 6 | ** Copyright (C) 2024 - Daniel Pointon, J. D. Mitchell 7 | ** 8 | ** This file is free software, see the digraphs/LICENSE. 9 | ** 10 | ********************************************************************************/ 11 | 12 | #ifndef DIGRAPHS_SRC_SAFEMALLOC_H_ 13 | #define DIGRAPHS_SRC_SAFEMALLOC_H_ 14 | 15 | #include // for size_t 16 | 17 | void* safe_malloc(size_t size); 18 | void* safe_calloc(size_t nitems, size_t size); 19 | 20 | #endif // DIGRAPHS_SRC_SAFEMALLOC_H_ 21 | -------------------------------------------------------------------------------- /src/cliques.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | *A cliques.h di/cliques Julius Jonusas 4 | ** 5 | ** Copyright (C) 2020 - Julius Jonusas 6 | ** 7 | ** This file is free software, see the digraphs/LICENSE. 8 | ** 9 | ********************************************************************************/ 10 | 11 | #ifndef DIGRAPHS_SRC_CLIQUES_H_ 12 | #define DIGRAPHS_SRC_CLIQUES_H_ 13 | 14 | // GAP headers 15 | #include "gap-includes.h" 16 | 17 | Obj FuncDIGRAPHS_FREE_CLIQUES_DATA(Obj self); 18 | Obj FuncDigraphsCliquesFinder(Obj self, Obj args); 19 | 20 | #endif // DIGRAPHS_SRC_CLIQUES_H_ 21 | -------------------------------------------------------------------------------- /src/globals.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A globals.h GAP package Digraphs James Mitchell 4 | ** Daniel Pointon 5 | ** 6 | ** 7 | ** 8 | ** Copyright (C) 2024 - James Mitchell, Daniel Pointon 9 | ** 10 | ** This file is free software, see the digraphs/LICENSE. 11 | ** 12 | *******************************************************************************/ 13 | 14 | #ifndef DIGRAPHS_SRC_GLOBALS_H_ 15 | #define DIGRAPHS_SRC_GLOBALS_H_ 16 | extern uint16_t HOMOS_STRUCTURE_SIZE; 17 | extern uint16_t UNDEFINED; 18 | #endif // DIGRAPHS_SRC_GLOBALS_H_ 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gapsystem/gap-docker 2 | 3 | MAINTAINER J. D. Mitchell 4 | 5 | COPY --chown=1000:1000 . $HOME/digraphs 6 | 7 | RUN rm -rf $HOME/inst/gap-${GAP_VERSION}/pkg/digraphs-* && mv $HOME/digraphs $HOME/inst/gap-${GAP_VERSION}/pkg/ && cd $HOME/inst/gap-${GAP_VERSION}/pkg/digraphs && ./autogen.sh && ./configure && make 8 | 9 | RUN sudo pip3 install ipywidgets RISE jupyter_francy 10 | 11 | RUN jupyter-nbextension install rise --user --py 12 | 13 | RUN jupyter-nbextension enable rise --user --py 14 | 15 | RUN sudo jupyter nbextension enable --user --py --sys-prefix jupyter_francy 16 | 17 | USER gap 18 | 19 | WORKDIR $HOME/inst/gap-${GAP_VERSION}/pkg/digraphs/notebooks 20 | -------------------------------------------------------------------------------- /tst/teststandard.g: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W teststandard.g 4 | #Y Copyright (C) 2021 Wilf A. Wilson 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | LoadPackage("digraphs", false);; 11 | if SizeBlist([DigraphsTestInstall(), 12 | DigraphsTestStandard(rec(earlyStop := false)), 13 | DIGRAPHS_RunTest(DigraphsTestManualExamples)]) = 3 then 14 | QUIT_GAP(0); 15 | else 16 | QUIT_GAP(1); 17 | fi; 18 | FORCE_QUIT_GAP(1); # if we ever get here, there was an error 19 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/TestSupport/generate_graphs.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM Change to correspond to the location of the geng executable 3 | SET gengPath="C:\Users\wbkbo\git\nauty\geng.exe" 4 | 5 | REM Change to correspond to the root output directory 6 | SET graphOutputDir="E:\graphs" 7 | 8 | SET /A N=11 9 | IF NOT "%1"=="" ( 10 | SET N=%1 11 | ) 12 | 13 | SET /A MAXM = (%N% * (%N% - 1^)) / 2 14 | 15 | IF NOT EXIST "%graphOutputDir%\%N%" mkdir "%graphOutputDir%\%N%" 16 | 17 | REM Make sure to update the path to the geng executable and the directory to which you wish to write the generated graphs 18 | FOR /L %%M IN (0,1,%MAXM%) DO ( 19 | START /B "geng%%M" %gengPath% %N% %%M:%%M > "%graphOutputDir%\%N%\n%N%.m%%M.g6" 20 | ) 21 | -------------------------------------------------------------------------------- /tst/testall.g: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W testall.g 4 | #Y Copyright (C) 2021 Wilf A. Wilson 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | LoadPackage("digraphs", false);; 11 | opts := rec(earlyStop := false); 12 | if SizeBlist([DigraphsTestInstall(), 13 | DigraphsTestStandard(opts), 14 | DIGRAPHS_RunTest(DigraphsTestManualExamples), 15 | DigraphsTestExtreme(opts)]) = 4 then 16 | QUIT_GAP(0); 17 | else 18 | QUIT_GAP(1); 19 | fi; 20 | FORCE_QUIT_GAP(1); # if we ever get here, there was an error 21 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/planarityRelated/graphDrawPlanar.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_DRAWPLANAR_H 2 | #define GRAPH_DRAWPLANAR_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graphStructures.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | #define DRAWPLANAR_NAME "DrawPlanar" 18 | 19 | int gp_AttachDrawPlanar(graphP theGraph); 20 | int gp_DetachDrawPlanar(graphP theGraph); 21 | 22 | int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName); 23 | int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This Digraphs package is 2 | 3 | Copyright (C) by Jan De Beule, Julius Jonušas, James D. Mitchell, 4 | Wilf A. Wilson, Michael Young et al. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/devEnvSetupAndDefaults/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[python]": { 3 | "editor.rulers": [ 4 | 79, 5 | 99 6 | ], 7 | "editor.defaultFormatter": "ms-python.black-formatter", 8 | "editor.formatOnSave": true 9 | }, 10 | "editor.formatOnSave": true, 11 | "editor.renderWhitespace": "all", 12 | "files.autoSave": "afterDelay", 13 | "python.analysis.typeCheckingMode": "basic", 14 | "black-formatter.cwd": "${workspaceFolder}/TestSupport/planaritytesting", 15 | "black-formatter.args": [ 16 | "--line-length=79", 17 | "--target-version=py312" 18 | ], 19 | "pylint.args": [ 20 | "--rcfile=${workspaceFolder}/TestSupport/planaritytesting/.pylintrc" 21 | ] 22 | } -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/planarityApp/planarity.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #include "planarity.h" 8 | 9 | /**************************************************************************** 10 | MAIN 11 | ****************************************************************************/ 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | int retVal = 0; 16 | 17 | if (argc <= 1) 18 | retVal = menu(); 19 | 20 | else if (argv[1][0] == '-') 21 | retVal = commandLine(argc, argv); 22 | 23 | else 24 | retVal = legacyCommandLine(argc, argv); 25 | 26 | // Close the log file if logging 27 | gp_Log(NULL); 28 | 29 | return retVal; 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *.Plo 3 | *.Tpo 4 | *.a 5 | *.aux 6 | *.bbl 7 | *.blg 8 | *.brf 9 | *.digraphs 10 | *.dylib 11 | *.g6 12 | *.gcda 13 | *.gcno 14 | *.guess 15 | *.gz 16 | *.html 17 | *.idx 18 | *.ilg 19 | *.ind 20 | *.la 21 | *.lab 22 | *.lo 23 | *.log 24 | *.o 25 | *.out 26 | *.pdf 27 | *.pnr 28 | *.pyc 29 | *.six 30 | *.status 31 | *.sub 32 | *.swo 33 | *.swp 34 | *.synctex.gz 35 | *.tex 36 | *.toc 37 | *.top 38 | *.tui 39 | *.txt 40 | .ipynb_checkpoints 41 | /doc/*.css 42 | /doc/*.js 43 | Makefile 44 | _*.xml 45 | aclocal.m4 46 | autom4te.* 47 | bin/ 48 | bliss 49 | compile 50 | configure 51 | coverage 52 | depcomp 53 | digraphs-config.h 54 | digraphs-lib 55 | doc/_*.xml 56 | doc/main.xml 57 | doc/title.xml 58 | gen/ 59 | gh-pages/ 60 | main.xml 61 | manual.lab 62 | missing 63 | src/pkgconfig.h.in 64 | tags 65 | tst/out/ 66 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graph.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERSTUB_GRAPH_H 2 | #define HELPERSTUB_GRAPH_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | // NOTE: This helper stub has been added for backwards compatibility to 11 | // support downstream consumers who expect graph.h to be at the 12 | // root of the installed planarity headers directory. Future downstream 13 | // consumers are advised to include the graphLib.h helper stub instead 14 | // because it offers access to all features in the graph library of 15 | // the planarity project. 16 | 17 | #ifdef __cplusplus 18 | extern "C" 19 | { 20 | #endif 21 | 22 | #include "c/graphLib/graph.h" 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/devEnvSetupAndDefaults/devEnvSetup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo -e "Copying VSCode configuration files.\n" 4 | cp -R .vscode ../ 5 | 6 | echo -e "Copying Python TestSupport pylint configuration file.\n" 7 | cp TestSupport/planaritytesting/.pylintrc ../TestSupport/planaritytesting/ 8 | 9 | echo -e "Copying planarity leaks orchestrator default configuration file.\n" 10 | cp TestSupport/planaritytesting/leaksorchestrator/planarity_leaks_config.ini ../TestSupport/planaritytesting/leaksorchestrator/ 11 | 12 | echo -e "Making directories for Random Graphs output.\n" 13 | mkdir -p ../random 14 | mkdir -p ../embedded 15 | mkdir -p ../adjlist 16 | mkdir -p ../obstructed 17 | mkdir -p ../error 18 | 19 | echo -e "Making m4 directory for autotools build process.\n" 20 | mkdir -p ../m4 21 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/extensionSystem/graphExtensions.private.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_EXTENSIONS_PRIVATE_H 2 | #define GRAPH_EXTENSIONS_PRIVATE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "graphFunctionTable.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | typedef struct 18 | { 19 | int moduleID; 20 | void *context; 21 | void *(*dupContext)(void *, void *); 22 | void (*freeContext)(void *); 23 | 24 | graphFunctionTableP functions; 25 | 26 | struct graphExtension *next; 27 | } graphExtension; 28 | 29 | typedef graphExtension *graphExtensionP; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/homos.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | *A homos.h di/graph homomorphisms Julius Jonusas 4 | ** J. D. Mitchell 5 | ** 6 | ** Copyright (C) 2014-19 - Julius Jonusas and J. D. Mitchell 7 | ** 8 | ** This file is free software, see the digraphs/LICENSE. 9 | ** 10 | ********************************************************************************/ 11 | 12 | #ifndef DIGRAPHS_SRC_HOMOS_H_ 13 | #define DIGRAPHS_SRC_HOMOS_H_ 14 | 15 | #define MAX(a, b) (a < b ? b : a) 16 | #define MIN(a, b) (a < b ? a : b) 17 | 18 | // GAP headers 19 | #include "gap-includes.h" 20 | 21 | Obj FuncDIGRAPHS_FREE_HOMOS_DATA(Obj self); 22 | Obj FuncHomomorphismDigraphsFinder(Obj self, Obj args); 23 | 24 | #endif // DIGRAPHS_SRC_HOMOS_H_ 25 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/devEnvSetupAndDefaults/TestSupport/planaritytesting/leaksorchestrator/planarity_leaks_config.ini: -------------------------------------------------------------------------------- 1 | [RandomGraphs] 2 | enabled = False 3 | perform_full_analysis = True 4 | num_graphs = 500 5 | order = 1000 6 | commands_to_run = 7 | 8 | [RandomMaxPlanarGraphGenerator] 9 | enabled = False 10 | perform_full_analysis = True 11 | order = 1000 12 | 13 | [SpecificGraph] 14 | enabled = False 15 | perform_full_analysis = True 16 | infile_path = >>CHANGEME<< 17 | commands_to_run = 18 | 19 | [RandomNonplanarGraphGenerator] 20 | enabled = False 21 | perform_full_analysis = True 22 | order = 1000 23 | 24 | [TransformGraph] 25 | enabled = False 26 | perform_full_analysis = True 27 | infile_path = >>CHANGEME<< 28 | output_formats_to_test = 29 | 30 | [TestAllGraphs] 31 | enabled = False 32 | perform_full_analysis = True 33 | infile_path = >>CHANGEME<< 34 | commands_to_run = 35 | 36 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 # Report coverage to 2 decimal places 3 | round: down # Round down 4 | range: "90...100" # Anything below 90% is coloured red (considered bad) 5 | 6 | status: # GitHub status checks to add to a PR 7 | project: # Check all of Digraphs 8 | default: 9 | informational: true # Don't fail the check if overall coverage decreases 10 | patch: # Check only the PR's diff 11 | default: 12 | target: 100 13 | threshold: 0 14 | informational: false # Do fail the check if the diff is not 100% covered 15 | changes: # Information about changes in coverage outside the diff 16 | default: 17 | informational: true # Don't fail the check 18 | 19 | # Comment to post on PRs 20 | comment: false 21 | 22 | ignore: 23 | - "extern/" 24 | - "gap/utils.gi" 25 | - "PackageInfo.g" 26 | - "init.g" 27 | - "makedoc.g" 28 | - "read.g" 29 | - "tst/" 30 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/TestSupport/planarity_runner.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Change to correspond to the location of the planarity executable 4 | SET planarityPath="C:\Users\wbkbo\git\edge-addition-planarity-suite-fork\Release\planarity.exe" 5 | 6 | REM Change to correspond to the parent of the test files directory 7 | SET graphFilesDir="E:\graphs" 8 | 9 | REM Change to correspond to the root output directory 10 | SET outputDir="C:\Users\wbkbo\git\edge-addition-planarity-suite-fork\TestSupport\results" 11 | 12 | SET /A N=11 13 | SET C=p 14 | IF NOT "%1"=="" ( 15 | SET N=%1 16 | IF NOT "%2"=="" ( 17 | SET C=%2 18 | ) 19 | ) 20 | 21 | IF NOT EXIST "%outputDir%\%N%\%C%" mkdir "%outputDir%\%N%\%C%" 22 | 23 | SET /A MAXM = (%N% * (%N% - 1^)) / 2 24 | 25 | FOR /L %%M IN (0,1,%MAXM%) DO ( 26 | CALL %planarityPath% -t -%C% "%graphFilesDir%\%N%\test.n%N%.m%%M.g6" "%outputDir%\%N%\%C%\n%N%.m%%M.%C%.out.txt" 27 | ) 28 | -------------------------------------------------------------------------------- /gap/constructors.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## constructors.gd 4 | ## Copyright (C) 2019 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | # This file contains constructions of certain types of digraphs, from other 12 | # digraphs. 13 | 14 | DeclareOperation("BipartiteDoubleDigraph", [IsDigraph]); 15 | DeclareOperation("DoubleDigraph", [IsDigraph]); 16 | 17 | DeclareOperation("DistanceDigraph", [IsDigraph, IsInt]); 18 | DeclareOperation("DistanceDigraph", [IsDigraph, IsList]); 19 | 20 | DeclareOperation("LineDigraph", [IsDigraph]); 21 | DeclareSynonym("EdgeDigraph", LineDigraph); 22 | DeclareOperation("LineUndirectedDigraph", [IsDigraph]); 23 | DeclareSynonym("EdgeUndirectedDigraph", LineUndirectedDigraph); 24 | -------------------------------------------------------------------------------- /tst/extreme/cliques.tst: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W extreme/cliques.tst 4 | #Y Copyright (C) 2024 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | #@local D 12 | gap> START_TEST("Digraphs package: extreme/cliques.tst"); 13 | gap> LoadPackage("digraphs", false);; 14 | 15 | # 16 | gap> DIGRAPHS_StartTest(); 17 | gap> D := 18 | > DigraphFromGraph6String("hJ\\zz{vJw~jvV^]^mvz\\~N^|{~xt~zJ~|N~~Y~~yf\ 19 | > ~~m~~~]~~~HR|nbmm~w^N}~Rmzv{inlnwcezjyBx{F{w}p~~VM]~~zH}T~~mvz~^~Lv~\ 20 | > }~~Y~~z^~nNv~n~yf~~n~~???????"); 21 | 22 | gap> Length(DigraphCliques(D)); 23 | 1651734 24 | 25 | # 26 | gap> DIGRAPHS_StopTest(); 27 | gap> STOP_TEST("Digraphs package: standard/cliques.tst", 0); 28 | -------------------------------------------------------------------------------- /gap/orbits.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## orbits.gd 4 | ## Copyright (C) 2016 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | DeclareGlobalFunction("DIGRAPHS_Orbits"); 12 | DeclareGlobalFunction("DIGRAPHS_TraceSchreierVector"); 13 | DeclareGlobalFunction("DIGRAPHS_EvaluateWord"); 14 | DeclareAttribute("DIGRAPHS_Stabilizers", IsDigraph, "mutable"); 15 | DeclareGlobalFunction("DIGRAPHS_AddOrbitToHashMap"); 16 | 17 | DeclareAttribute("DigraphGroup", IsDigraph); 18 | DeclareAttribute("DigraphOrbits", IsDigraph); 19 | DeclareAttribute("DigraphOrbitReps", IsDigraph); 20 | DeclareOperation("DigraphStabilizer", [IsDigraph, IsPosInt]); 21 | DeclareAttribute("DigraphSchreierVector", IsDigraph); 22 | DeclareAttribute("RepresentativeOutNeighbours", IsDigraph); 23 | -------------------------------------------------------------------------------- /src/safemalloc.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | *A safemalloc.c Safer memory allocation 4 | ** 5 | ** 6 | ** Copyright (C) 2024 - Daniel Pointon, J. D. Mitchell 7 | ** 8 | ** This file is free software, see the digraphs/LICENSE. 9 | ** 10 | ********************************************************************************/ 11 | 12 | #include "safemalloc.h" 13 | 14 | #include // for malloc 15 | 16 | #include "gap-includes.h" 17 | 18 | void* safe_malloc(size_t size) { 19 | void* allocation = malloc(size); 20 | if (allocation == NULL) { 21 | ErrorQuit("Call to malloc(%d) failed, giving up!", (Int) size, 0L); 22 | } 23 | return allocation; 24 | } 25 | 26 | void* safe_calloc(size_t nitems, size_t size) { 27 | void* allocation = calloc(nitems, size); 28 | if (allocation == NULL) { 29 | ErrorQuit( 30 | "Call to calloc(%d, %d) failed, giving up!", (Int) nitems, (Int) size); 31 | } 32 | 33 | return allocation; 34 | } 35 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/TestSupport/planaritytesting/__init__.py: -------------------------------------------------------------------------------- 1 | """Tools to help investigate K_{3, 3} search graph algorithm extension bug""" 2 | 3 | __all__ = [ 4 | "planaritytesting_utils", 5 | "graph_generation_orchestrator", 6 | "planarity_testAllGraphs_orchestrator", 7 | "g6_diff_finder", 8 | "planarity_testAllGraphs_output_parsing", 9 | "graph", 10 | "edge_deletion_analysis", 11 | "test_table_generator", 12 | ] 13 | 14 | import logging 15 | 16 | from . import planaritytesting_utils 17 | from . import graph_generation_orchestrator 18 | from . import planarity_testAllGraphs_orchestrator 19 | from . import g6_diff_finder 20 | from . import planarity_testAllGraphs_output_parsing 21 | from . import graph 22 | from . import edge_deletion_analysis 23 | from . import test_table_generator 24 | 25 | # This ensures that no logging occurs by default unless a logger has been 26 | # properly configured on a per-module basis 27 | logging.getLogger(__name__).addHandler(logging.NullHandler()) 28 | -------------------------------------------------------------------------------- /extern/eaps_flags.h: -------------------------------------------------------------------------------- 1 | #if defined(__clang__) 2 | #pragma clang diagnostic ignored "-Wdeprecated-non-prototype" 3 | #pragma clang diagnostic ignored "-Wformat-nonliteral" 4 | #pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" 5 | #pragma clang diagnostic ignored "-Wmissing-prototypes" 6 | #pragma clang diagnostic ignored "-Wstrict-prototypes" 7 | #endif 8 | #if defined(__GNUC__) && !defined(__clang__) 9 | #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" 10 | #pragma GCC diagnostic ignored "-Wformat-nonliteral" 11 | #pragma GCC diagnostic ignored "-Wmissing-prototypes" 12 | #pragma GCC diagnostic ignored "-Wold-style-definition" 13 | #pragma GCC diagnostic ignored "-Wshadow" 14 | #pragma GCC diagnostic ignored "-Wstrict-prototypes" 15 | #pragma GCC diagnostic ignored "-Wswitch-default" 16 | #pragma GCC diagnostic ignored "-Wunused-result" 17 | #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" 18 | #pragma GCC diagnostic ignored "-Wredundant-decls" 19 | #pragma GCC diagnostic ignored "-Wnull-dereference" 20 | #endif 21 | -------------------------------------------------------------------------------- /src/planar.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | *A planar.h Planarity testing 4 | ** 5 | ** 6 | ** Copyright (C) 2018 - J. D. Mitchell 7 | ** 8 | ** This file is free software, see the digraphs/LICENSE. 9 | ** 10 | ********************************************************************************/ 11 | 12 | #ifndef DIGRAPHS_SRC_PLANAR_H_ 13 | #define DIGRAPHS_SRC_PLANAR_H_ 14 | 15 | // GAP headers 16 | #include "gap-includes.h" 17 | 18 | Obj FuncIS_PLANAR(Obj self, Obj digraph); 19 | Obj FuncKURATOWSKI_PLANAR_SUBGRAPH(Obj self, Obj digraph); 20 | Obj FuncPLANAR_EMBEDDING(Obj self, Obj digraph); 21 | 22 | Obj FuncIS_OUTER_PLANAR(Obj self, Obj digraph); 23 | Obj FuncKURATOWSKI_OUTER_PLANAR_SUBGRAPH(Obj self, Obj digraph); 24 | Obj FuncOUTER_PLANAR_EMBEDDING(Obj self, Obj digraph); 25 | 26 | Obj FuncSUBGRAPH_HOMEOMORPHIC_TO_K23(Obj self, Obj digraph); 27 | Obj FuncSUBGRAPH_HOMEOMORPHIC_TO_K33(Obj self, Obj digraph); 28 | Obj FuncSUBGRAPH_HOMEOMORPHIC_TO_K4(Obj self, Obj digraph); 29 | 30 | #endif // DIGRAPHS_SRC_PLANAR_H_ 31 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/g6-api-utilities.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #include "g6-api-utilities.h" 8 | 9 | int _getMaxEdgeCount(int graphOrder) 10 | { 11 | return (graphOrder * (graphOrder - 1)) / 2; 12 | } 13 | 14 | int _getNumCharsForGraphEncoding(int graphOrder) 15 | { 16 | int maxNumEdges = _getMaxEdgeCount(graphOrder); 17 | 18 | return (maxNumEdges / 6) + (maxNumEdges % 6 ? 1 : 0); 19 | } 20 | 21 | int _getNumCharsForGraphOrder(int graphOrder) 22 | { 23 | if (graphOrder > 0 && graphOrder < 63) 24 | { 25 | return 1; 26 | } 27 | else if (graphOrder >= 63 && graphOrder <= 100000) 28 | { 29 | return 4; 30 | } 31 | 32 | return -1; 33 | } 34 | 35 | int _getExpectedNumPaddingZeroes(const int graphOrder, const int numChars) 36 | { 37 | int maxNumEdges = _getMaxEdgeCount(graphOrder); 38 | int expectedNumPaddingZeroes = numChars * 6 - maxNumEdges; 39 | 40 | return expectedNumPaddingZeroes; 41 | } 42 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/extensionSystem/graphExtensions.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_EXTENSIONS_H 2 | #define GRAPH_EXTENSIONS_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include "../graphStructures.h" 16 | 17 | int gp_AddExtension(graphP theGraph, 18 | int *pModuleID, 19 | void *context, 20 | void *(*dupContext)(void *, void *), 21 | void (*freeContext)(void *), 22 | graphFunctionTableP overloadTable); 23 | 24 | int gp_FindExtension(graphP theGraph, int moduleID, void **pContext); 25 | void *gp_GetExtension(graphP theGraph, int moduleID); 26 | 27 | int gp_RemoveExtension(graphP theGraph, int moduleID); 28 | 29 | int gp_CopyExtensions(graphP dstGraph, graphP srcGraph); 30 | 31 | void gp_FreeExtensions(graphP theGraph); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /gap/utils.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## utils.gd 4 | ## Copyright (C) 2014-17 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | DeclareGlobalFunction("DIGRAPHS_OmitFromTests"); 12 | 13 | DeclareGlobalFunction("DIGRAPHS_Dir"); 14 | DeclareGlobalFunction("DIGRAPHS_ManualExamples"); 15 | DeclareGlobalFunction("DIGRAPHS_StartTest"); 16 | DeclareGlobalFunction("DIGRAPHS_StopTest"); 17 | DeclareGlobalFunction("DIGRAPHS_Test"); 18 | DeclareGlobalFunction("DIGRAPHS_RunTest"); 19 | 20 | DeclareGlobalFunction("DigraphsMakeDoc"); 21 | DeclareGlobalFunction("DigraphsTestAll"); 22 | DeclareGlobalFunction("DigraphsTestExtreme"); 23 | DeclareGlobalFunction("DigraphsTestInstall"); 24 | DeclareGlobalFunction("DigraphsTestStandard"); 25 | DeclareGlobalFunction("DigraphsTestManualExamples"); 26 | 27 | DeclareGlobalFunction("DIGRAPHS_BlistNumber"); 28 | DeclareGlobalFunction("DIGRAPHS_NumberBlist"); 29 | DeclareGlobalFunction("DError"); 30 | -------------------------------------------------------------------------------- /m4/ax_check_bliss.m4: -------------------------------------------------------------------------------- 1 | dnl handle bliss checks 2 | dnl 3 | dnl if --with-external-bliss is supplied, 4 | dnl use it if it is known to pkg-config and is new enough; 5 | dnl otherwise use the included version 6 | dnl 7 | AC_DEFUN([AX_CHECK_BLISS], [ 8 | AC_ARG_WITH([external-bliss], 9 | [AS_HELP_STRING([--with-external-bliss], 10 | [use external bliss])], 11 | [], 12 | [with_external_bliss=no]) 13 | AC_MSG_CHECKING([whether to use external bliss]) 14 | AC_MSG_RESULT([$with_external_bliss]) 15 | if test "x$with_external_bliss" = xyes ; then 16 | AC_LANG_PUSH([C]) 17 | AC_CHECK_LIB([bliss], 18 | [bliss_add_edge], 19 | [], 20 | [AC_MSG_ERROR([no external libbliss found])]) 21 | 22 | AC_CHECK_HEADER([bliss/bliss_C.h], 23 | [], 24 | [AC_MSG_ERROR([no external bliss headers found])]) 25 | AC_LANG_POP() 26 | fi 27 | if test "x$with_external_bliss" = xno ; then 28 | WITH_INCLUDED_BLISS=yes 29 | AC_SUBST(WITH_INCLUDED_BLISS) 30 | AC_DEFINE([WITH_INCLUDED_BLISS], 31 | [1], 32 | [define that we should use the vendored bliss]) 33 | fi 34 | ]) 35 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/lowLevelUtils/apiutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | #ifndef APIUTILS_H 7 | #define APIUTILS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | #include "stdio.h" 15 | 16 | // N.B. Every time this is used to create a string for a message or 17 | // error message, the developer must check that there will not be a 18 | // memory overwrite error. 19 | #define MAXLINE 1024 20 | 21 | // N.B. Every time you're trying to read a 32-bit int from a string, 22 | // you should only need to read this many characters: an optional '-', 23 | // followed by 10 digits (max signed 32-bit int value is 2,147,483,647). 24 | // One must always allocate an additional byte for the null-terminator! 25 | #define MAXCHARSFOR32BITINT 11 26 | 27 | extern int quietMode; 28 | 29 | extern int getQuietModeSetting(void); 30 | extern void setQuietModeSetting(int); 31 | 32 | extern void Message(char *message); 33 | extern void ErrorMessage(char *message); 34 | 35 | int GetNumCharsToReprInt(int theNum, int *numCharsRequired); 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif -------------------------------------------------------------------------------- /src/gap-includes.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A gap-includes.h GAP package Digraphs Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-24 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #ifndef DIGRAPHS_SRC_GAP_INCLUDES_H_ 16 | #define DIGRAPHS_SRC_GAP_INCLUDES_H_ 17 | 18 | #if defined(__clang__) 19 | #pragma clang diagnostic push 20 | #pragma clang diagnostic ignored "-Wdeclaration-after-statement" 21 | #elif defined(__GNUC__) 22 | #pragma GCC diagnostic push 23 | #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" 24 | #pragma GCC diagnostic ignored "-Wpedantic" 25 | #pragma GCC diagnostic ignored "-Winline" 26 | #endif 27 | // GAP headers 28 | #include "gap_all.h" // for Obj, Int 29 | // 30 | #endif // DIGRAPHS_SRC_GAP_INCLUDES_H_ 31 | -------------------------------------------------------------------------------- /gap/display.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## display.gd 4 | ## Copyright (C) 2017-19 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | DeclareAttribute("DotDigraph", IsDigraph); 12 | DeclareOperation("DotColoredDigraph", [IsDigraph, IsList, IsList]); 13 | DeclareOperation("DotVertexColoredDigraph", [IsDigraph, IsList]); 14 | DeclareOperation("DotEdgeColoredDigraph", [IsDigraph, IsList]); 15 | DeclareOperation("DotVertexLabelledDigraph", [IsDigraph]); 16 | DeclareAttribute("DotSymmetricDigraph", IsDigraph); 17 | DeclareOperation("DotSymmetricColoredDigraph", [IsDigraph, IsList, IsList]); 18 | DeclareOperation("DotSymmetricVertexColoredDigraph", [IsDigraph, IsList]); 19 | DeclareOperation("DotSymmetricEdgeColoredDigraph", [IsDigraph, IsList]); 20 | DeclareAttribute("DotPartialOrderDigraph", IsDigraph); 21 | DeclareAttribute("DotPreorderDigraph", IsDigraph); 22 | DeclareSynonym("DotQuasiorderDigraph", DotPreorderDigraph); 23 | DeclareOperation("DotHighlightedDigraph", [IsDigraph, IsList]); 24 | DeclareOperation("DotHighlightedDigraph", 25 | [IsDigraph, IsList, IsString, IsString]); 26 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | - stable-*.* 9 | schedule: 10 | # Every day at 3:30 AM UTC 11 | - cron: 30 3 * * * 12 | 13 | concurrency: 14 | # Group by workflow and ref; the last component ensures that for pull requests 15 | # we limit to one concurrent job, but for the main/stable branches we don't 16 | group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/stable-')) || github.run_number }} 17 | # Only cancel intermediate pull request builds 18 | cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} 19 | 20 | jobs: 21 | lint: 22 | name: ${{ matrix.linter }} 23 | runs-on: ubuntu-latest 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | linter: 28 | - gaplint 29 | - cpplint 30 | steps: 31 | - name: Check out the repository . . . 32 | uses: actions/checkout@v5 33 | - name: Set up Python . . . 34 | uses: actions/setup-python@v6 35 | - name: Install ${{ matrix.linter }} with pip . . . 36 | run: pip install ${{ matrix.linter }} 37 | - name: Run ${{ matrix.linter }} on the Digraphs package . . . 38 | run: bash etc/${{ matrix.linter }}.sh 39 | -------------------------------------------------------------------------------- /m4/ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 2 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /etc/tst-local-vars.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | This simple script adds the local variables used in a GAP tst file to the top 4 | of the file. 5 | """ 6 | import os 7 | import re 8 | import sys 9 | import textwrap 10 | 11 | import yaml 12 | from bs4 import BeautifulSoup 13 | 14 | 15 | def main(): 16 | if sys.version_info[0] < 3: 17 | raise Exception("Python 3 is required") 18 | args = sys.argv[1:] 19 | pattern1 = re.compile(r"(\w+)\s*:=") 20 | pattern2 = re.compile(r"for (\w+) in") 21 | for fname in args: 22 | lvars = [] 23 | with open(fname, "r") as f: 24 | lines = f.read() 25 | lvars.extend([x.group(1) for x in re.finditer(pattern1, lines)]) 26 | lvars.extend([x.group(1) for x in re.finditer(pattern2, lines)]) 27 | lvars = ", ".join(sorted([*{*lvars}])) 28 | lvars = [x if x[-1] != "," else x[:-1] for x in textwrap.wrap(lvars, width=72)] 29 | lvars = [""] + ["#@local " + x for x in lvars] 30 | lines = lines.split("\n") 31 | pos = next(i for i in range(len(lines)) if "START_TEST" in lines[i]) 32 | lines = lines[:pos] + lvars + lines[pos:] 33 | lines = "\n".join(lines) 34 | with open(fname, "w") as f: 35 | print(f"Writing local variables to {fname}...") 36 | f.write(lines) 37 | 38 | 39 | if __name__ == "__main__": 40 | main() 41 | -------------------------------------------------------------------------------- /src/digraphs-debug.h: -------------------------------------------------------------------------------- 1 | // 2 | // Digraphs package for GAP 3 | // Copyright (C) 2017 James D. Mitchell 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | // 18 | 19 | // This file declares kernel debugging functionality. 20 | 21 | #ifndef DIGRAPHS_SRC_DIGRAPHS_DEBUG_H_ 22 | #define DIGRAPHS_SRC_DIGRAPHS_DEBUG_H_ 23 | 24 | // C headers 25 | #include // for assert 26 | 27 | // Digraphs package headers 28 | #include "digraphs-config.h" // for DIGRAPHS_KERNEL_DEBUG 29 | 30 | // DIGRAPHS_ASSERT is a version of 'assert' which is enabled by the 31 | // configure option --enable-debug 32 | 33 | #ifdef DIGRAPHS_KERNEL_DEBUG 34 | #define DIGRAPHS_ASSERT(x) assert(x) 35 | #else 36 | #define DIGRAPHS_ASSERT(x) 37 | #endif 38 | 39 | #endif // DIGRAPHS_SRC_DIGRAPHS_DEBUG_H_ 40 | -------------------------------------------------------------------------------- /src/digraphs.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A digraphs.h GAP package Digraphs Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-15 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #ifndef DIGRAPHS_SRC_DIGRAPHS_H_ 16 | #define DIGRAPHS_SRC_DIGRAPHS_H_ 17 | 18 | // GAP headers 19 | #include "gap-includes.h" // for Obj, Int 20 | 21 | Int DigraphNrVertices(Obj D); 22 | Obj FuncOutNeighbours(Obj self, Obj D); 23 | Obj FuncIS_ANTISYMMETRIC_DIGRAPH(Obj self, Obj D); 24 | Obj FuncADJACENCY_MATRIX(Obj self, Obj D); 25 | 26 | Int DigraphNrEdges(Obj digraph); 27 | Int DigraphNrAdjacencies(Obj digraph); 28 | Int DigraphNrAdjacenciesWithoutLoops(Obj digraph); 29 | Obj DigraphSource(Obj digraph); 30 | Obj DigraphRange(Obj digraph); 31 | 32 | extern Obj AutomorphismGroup; 33 | extern Obj DIGRAPHS_ValidateVertexColouring; 34 | extern Obj GeneratorsOfGroup; 35 | extern Obj IsDigraph; 36 | extern Obj IsMultiDigraph; 37 | extern Obj IsDigraphEdge; 38 | extern Obj InfoWarning; 39 | 40 | #endif // DIGRAPHS_SRC_DIGRAPHS_H_ 41 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/configure.ac: -------------------------------------------------------------------------------- 1 | # The version number in the following line must be synchronized with 2 | # the project version numbering in graphLib.h 3 | AC_INIT([planarity],[4.0.0.0],[jboyer@acm.org]) 4 | AM_INIT_AUTOMAKE([subdir-objects] [foreign]) 5 | AC_CONFIG_MACRO_DIRS([m4]) 6 | AC_CONFIG_SRCDIR([c/]) 7 | 8 | # The version of the libtool library is of the form current:revision:age 9 | # 10 | # See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 11 | # 12 | # The version number in the following line must be synchronized with 13 | # the LibPlanarity version numbers in graphLib.h 14 | # 15 | # When doing a release, they should be updated like this: 16 | # 1. If no interfaces changed, only implementations: just increment 17 | # revision. 18 | # 2. If interfaces were added, none removed: increment current, set 19 | # revision to zero and increment age. 20 | # 3. If interfaces were removed (breaks backward compatibility): increment 21 | # current, and set both revision and age to zero. 22 | LT_CURRENT=2 23 | LT_REVISION=0 24 | LT_AGE=0 25 | AC_SUBST(LT_CURRENT) 26 | AC_SUBST(LT_REVISION) 27 | AC_SUBST(LT_AGE) 28 | 29 | PKG_INSTALLDIR 30 | 31 | AC_PROG_CC 32 | LT_INIT 33 | AC_PROG_INSTALL 34 | 35 | AC_CHECK_HEADERS([ctype.h stdio.h stdlib.h string.h time.h unistd.h]) 36 | 37 | AC_CONFIG_FILES([ 38 | Makefile 39 | c/samples/Makefile 40 | ]) 41 | AC_CONFIG_FILES([test-samples.sh], [chmod +x test-samples.sh]) 42 | AC_CONFIG_FILES([libplanarity.pc]) 43 | 44 | AC_OUTPUT 45 | -------------------------------------------------------------------------------- /extern/bliss-0.73/timer.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_TIMER_HH 2 | #define BLISS_TIMER_HH 3 | 4 | /* 5 | Copyright (c) 2003-2015 Tommi Junttila 6 | Released under the GNU Lesser General Public License version 3. 7 | 8 | This file is part of bliss. 9 | 10 | bliss is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation, version 3 of the License. 13 | 14 | bliss is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with bliss. If not, see . 21 | */ 22 | 23 | namespace bliss_digraphs { 24 | 25 | /** \internal 26 | * \brief A very simple wrapper class for measuring elapsed user+system time. 27 | * Not essential if you are using bliss as a library. 28 | */ 29 | 30 | class Timer 31 | { 32 | double start_time; 33 | public: 34 | /** 35 | * Create and start a new timer. 36 | */ 37 | Timer(); 38 | 39 | /** 40 | * Reset the timer. 41 | */ 42 | void reset(); 43 | 44 | /** 45 | * Get the user+system time (in seconds) elapsed since the creation or 46 | * the last reset() call of the timer. 47 | */ 48 | double get_duration(); 49 | }; 50 | 51 | } // namespace bliss_digraphs 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /m4/ax_check_planarity.m4: -------------------------------------------------------------------------------- 1 | dnl handle planarity checks 2 | dnl 3 | dnl if --with-external-planarity is supplied, 4 | dnl use it if it is known to pkg-config and is new enough; 5 | dnl otherwise use the included version 6 | dnl 7 | AC_DEFUN([AX_CHECK_PLANARITY], [ 8 | AC_ARG_WITH([external-planarity], 9 | [AS_HELP_STRING([--with-external-planarity], 10 | [use external planarity])], 11 | [], 12 | [with_external_planarity=no]) 13 | AC_MSG_CHECKING([whether to use external planarity]) 14 | AC_MSG_RESULT([$with_external_planarity]) 15 | AS_IF([test "x$with_external_planarity" = xyes], [ 16 | AC_MSG_CHECKING([for external libplanarity]) 17 | saved_LIBS="$LIBS" 18 | LIBS="$LIBS -lplanarity" 19 | AC_LANG_PUSH([C]) 20 | AC_LINK_IFELSE([AC_LANG_SOURCE([ 21 | #include 22 | #if defined(GP_PROJECTVERSION_MAJOR) && GP_PROJECTVERSION_MAJOR >= 4 23 | #else 24 | #error too old 25 | #endif 26 | int main(void) { gp_InitGraph(0, 0); } 27 | ])], [ 28 | AC_MSG_RESULT([yes]) 29 | ], [ 30 | AC_MSG_RESULT([not found or too old]) 31 | LIBS="$saved_LIBS" 32 | with_external_planarity=no 33 | ]) 34 | AC_LANG_POP() 35 | ]) 36 | AS_IF([test "x$with_external_planarity" = xno], [ 37 | WITH_INCLUDED_PLANARITY=yes 38 | AC_SUBST(WITH_INCLUDED_PLANARITY) 39 | AC_DEFINE([WITH_INCLUDED_PLANARITY], 40 | [1], 41 | [define that we should use the vendored planarity]) 42 | ]) 43 | ]) 44 | -------------------------------------------------------------------------------- /tst/workspaces/load-workspace.tst: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W workspaces/load-workspace.tst 4 | #Y Copyright (C) 2017 Wilf A. Wilson 5 | ## Michael Young 6 | ## 7 | ## Licensing information can be found in the README file of this package. 8 | ## 9 | ############################################################################# 10 | ## 11 | ## This file, together with save-workspace.tst, tests the ability to save 12 | ## and load workspaces which include Digraph objects. Objects should be 13 | ## created and stored in save-workspace.tst, and then loaded and tested in 14 | ## load-workspace.tst to ensure that they work correctly after being saved. 15 | ## 16 | ############################################################################# 17 | 18 | # Set up testing environment 19 | 20 | gap> START_TEST("Digraphs package: workspaces/load-workspace.tst"); 21 | gap> DIGRAPHS_StartTest(); 22 | 23 | ############################################################################# 24 | ## Test objects that were created in save-workspace.tst, using the same 25 | ## variable names. 26 | ############################################################################# 27 | 28 | # Temporary 29 | gap> DigraphNrVertices(gr); 30 | 1 31 | 32 | ############################################################################# 33 | ## Tests end here 34 | ############################################################################# 35 | 36 | # 37 | gap> STOP_TEST("Digraphs package: workspaces/load-workspace.tst", 0); 38 | -------------------------------------------------------------------------------- /gap/grape.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## grape.gd 4 | ## Copyright (C) 2019 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | DeclareOperation("Graph", [IsDigraph]); 12 | 13 | # Cayley digraphs 14 | DeclareConstructor("CayleyDigraphCons", [IsDigraph, IsGroup, IsList]); 15 | 16 | DeclareOperation("CayleyDigraph", [IsGroup]); 17 | DeclareOperation("CayleyDigraph", [IsGroup, IsList]); 18 | DeclareOperation("CayleyDigraph", [IsFunction, IsGroup]); 19 | DeclareOperation("CayleyDigraph", [IsFunction, IsGroup, IsList]); 20 | 21 | DeclareAttribute("GroupOfCayleyDigraph", IsCayleyDigraph); 22 | DeclareAttribute("SemigroupOfCayleyDigraph", IsCayleyDigraph); 23 | DeclareAttribute("GeneratorsOfCayleyDigraph", IsCayleyDigraph); 24 | 25 | DeclareOperation("Digraph", [IsFunction, 26 | IsGroup, 27 | IsListOrCollection, 28 | IsFunction, 29 | IsFunction]); 30 | DeclareOperation("Digraph", [IsGroup, 31 | IsListOrCollection, 32 | IsFunction, 33 | IsFunction]); 34 | 35 | DeclareOperation("EdgeOrbitsDigraph", [IsPermGroup, IsList, IsInt]); 36 | DeclareOperation("EdgeOrbitsDigraph", [IsPermGroup, IsList]); 37 | DeclareOperation("DigraphAddEdgeOrbit", [IsDigraph, IsList]); 38 | DeclareOperation("DigraphRemoveEdgeOrbit", [IsDigraph, IsList]); 39 | -------------------------------------------------------------------------------- /etc/tst-unbind-local-vars.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | This simple script adds the "Unbind" statements to the end of a GAP tst file. 4 | """ 5 | import os 6 | import re 7 | import sys 8 | import textwrap 9 | 10 | import yaml 11 | from bs4 import BeautifulSoup 12 | 13 | 14 | def main(): 15 | if sys.version_info[0] < 3: 16 | raise Exception("Python 3 is required") 17 | args = sys.argv[1:] 18 | pattern1 = re.compile(r"(\w+)\s*:=") 19 | pattern2 = re.compile(r"for (\w+) in") 20 | for fname in args: 21 | lvars = [] 22 | with open(fname, "r") as f: 23 | lines = f.read() 24 | lvars.extend([x.group(1) for x in re.finditer(pattern1, lines)]) 25 | lvars.extend([x.group(1) for x in re.finditer(pattern2, lines)]) 26 | lvars = sorted([*{*lvars}]) 27 | lvars = [ 28 | "# Unbind local variables, auto-generated by etc/tst-unbind-local-vars.py" 29 | ] + [f"gap> Unbind({lvar});" for lvar in lvars] 30 | lvars.append("") 31 | lines = lines.split("\n") 32 | pos1 = next(i for i in range(len(lines)) if "STOP_TEST" in lines[i]) - 1 33 | try: 34 | pos0 = next( 35 | i 36 | for i in range(len(lines)) 37 | if "etc/tst-unbind-local-vars.py" in lines[i] 38 | ) 39 | except StopIteration: 40 | pos0 = pos1 41 | lines = lines[:pos0] + lvars + lines[pos1:] 42 | lines = "\n".join(lines) 43 | with open(fname, "w") as f: 44 | print(f"Writing local variables to {fname}...") 45 | f.write(lines) 46 | 47 | 48 | if __name__ == "__main__": 49 | main() 50 | -------------------------------------------------------------------------------- /.github/workflows/manual.yml: -------------------------------------------------------------------------------- 1 | name: Manual 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | - stable-*.* 9 | schedule: 10 | # Every day at 3:20 AM UTC 11 | - cron: "20 3 * * *" 12 | 13 | concurrency: 14 | # Group by workflow and ref; the last component ensures that for pull requests 15 | # we limit to one concurrent job, but for the main/stable branches we don't 16 | group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/stable-')) || github.run_number }} 17 | # Only cancel intermediate pull request builds 18 | cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} 19 | 20 | jobs: 21 | manual: 22 | name: compile and upload manual 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v5 26 | - name: Install TeX Live . . . 27 | run: | 28 | packages=( 29 | texlive-latex-base 30 | texlive-latex-recommended 31 | texlive-latex-extra 32 | texlive-extra-utils 33 | texlive-fonts-recommended 34 | texlive-fonts-extra 35 | ) 36 | sudo apt-get update 37 | sudo apt-get install "${packages[@]}" 38 | - uses: gap-actions/setup-gap@v3 39 | with: 40 | gap-version: latest 41 | - uses: gap-actions/build-pkg-docs@v2 42 | - name: Upload compiled manuals . . . 43 | uses: actions/upload-artifact@v5 44 | with: 45 | name: Digraphs manual 46 | retention-days: 7 47 | path: | 48 | doc/manual.pdf 49 | doc/*.html 50 | doc/*.css 51 | doc/*.js 52 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK33Search.private.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K33SEARCH_PRIVATE_H 2 | #define GRAPH_K33SEARCH_PRIVATE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graph.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | // Additional equipment for each EdgeRec 18 | typedef struct 19 | { 20 | int noStraddle, pathConnector; 21 | } K33Search_EdgeRec; 22 | 23 | typedef K33Search_EdgeRec *K33Search_EdgeRecP; 24 | 25 | // Additional equipment for each primary vertex 26 | typedef struct 27 | { 28 | int separatedDFSChildList, backArcList, mergeBlocker; 29 | } K33Search_VertexInfo; 30 | 31 | typedef K33Search_VertexInfo *K33Search_VertexInfoP; 32 | 33 | typedef struct 34 | { 35 | // Helps distinguish initialize from re-initialize 36 | int initialized; 37 | 38 | // The graph that this context augments 39 | graphP theGraph; 40 | 41 | // Parallel array for additional edge level equipment 42 | K33Search_EdgeRecP E; 43 | 44 | // Parallel array for additional vertex info level equipment 45 | K33Search_VertexInfoP VI; 46 | 47 | // Storage for the separatedDFSChildLists, and 48 | // to help with linear time sorting of same by lowpoints 49 | listCollectionP separatedDFSChildLists; 50 | int *buckets; 51 | listCollectionP bin; 52 | 53 | // Overloaded function pointers 54 | graphFunctionTable functions; 55 | 56 | } K33SearchContext; 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /m4/ax_append_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_append_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space 12 | # added in between. 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains 16 | # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly 17 | # FLAG. 18 | # 19 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. 20 | # 21 | # LICENSE 22 | # 23 | # Copyright (c) 2008 Guido U. Draheim 24 | # Copyright (c) 2011 Maarten Bosmans 25 | # 26 | # Copying and distribution of this file, with or without modification, are 27 | # permitted in any medium without royalty provided the copyright notice 28 | # and this notice are preserved. This file is offered as-is, without any 29 | # warranty. 30 | 31 | #serial 8 32 | 33 | AC_DEFUN([AX_APPEND_FLAG], 34 | [dnl 35 | AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF 36 | AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) 37 | AS_VAR_SET_IF(FLAGS,[ 38 | AS_CASE([" AS_VAR_GET(FLAGS) "], 39 | [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], 40 | [ 41 | AS_VAR_APPEND(FLAGS,[" $1"]) 42 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 43 | ]) 44 | ], 45 | [ 46 | AS_VAR_SET(FLAGS,[$1]) 47 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 48 | ]) 49 | AS_VAR_POPDEF([FLAGS])dnl 50 | ])dnl AX_APPEND_FLAG 51 | -------------------------------------------------------------------------------- /tst/extreme/named.tst: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W extreme/named.tst 4 | #Y Copyright (C) 2021 Tom D. Conti-Leslie 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | ## This tests attributes of all digraphs stored in the named digraphs main 11 | ## database against known values. Attributes tested are largely from House 12 | ## of Graphs at hog.grinvin.org. 13 | ## 14 | 15 | #@local D, failed, name, names, prop, properties, r 16 | gap> START_TEST("Digraphs package: extreme/named.tst"); 17 | gap> LoadPackage("digraphs", false);; 18 | 19 | # 20 | gap> DIGRAPHS_StartTest(); 21 | 22 | # Load the record of stored test values 23 | gap> DIGRAPHS_LoadNamedDigraphsTests(); 24 | gap> r := DIGRAPHS_NamedDigraphsTests;; 25 | 26 | # For each graph, test Digraphs-generated properties against stored values. 27 | # "failed" is a list of pairs [name, prop] where the digraph called "name" 28 | # did not coincide with the test record on property "prop". The test is 29 | # passed if this list remains empty. If it contains digraphs, you should check 30 | # those digraphs for errors. 31 | gap> names := RecNames(r);; 32 | gap> failed := [];; 33 | gap> for name in names do 34 | > D := Digraph(name);; 35 | > properties := r.(name);; 36 | > for prop in RecNames(properties) do 37 | > if ValueGlobal(prop)(D) <> properties.(prop) then 38 | > Add(failed, [name, prop]);; 39 | > fi; 40 | > od; 41 | > od; 42 | gap> failed; 43 | [ ] 44 | 45 | # 46 | gap> DIGRAPHS_StopTest(); 47 | gap> STOP_TEST("Digraphs package: extreme/named.tst", 0); 48 | -------------------------------------------------------------------------------- /extern/bliss-0.73/defs.cc: -------------------------------------------------------------------------------- 1 | #include "defs.hh" 2 | #include 3 | #include 4 | 5 | /* 6 | Copyright (c) 2003-2015 Tommi Junttila 7 | Released under the GNU Lesser General Public License version 3. 8 | 9 | This file is part of bliss. 10 | 11 | bliss is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU Lesser General Public License as published by 13 | the Free Software Foundation, version 3 of the License. 14 | 15 | bliss is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with bliss. If not, see . 22 | */ 23 | 24 | #if defined(__clang__) 25 | #pragma clang diagnostic push 26 | #pragma clang diagnostic ignored "-Wformat-nonliteral" 27 | #pragma clang diagnostic ignored "-Wmissing-noreturn" 28 | #elif defined(__GNUC__) 29 | #pragma GCC diagnostic push 30 | #pragma GCC diagnostic ignored "-Wformat-nonliteral" 31 | #pragma GCC diagnostic ignored "-Wmissing-noreturn" 32 | #pragma GCC diagnostic ignored "-Wsuggest-attribute=format" 33 | #endif 34 | namespace bliss_digraphs { 35 | 36 | void fatal_error(const char* fmt, ...) { 37 | va_list ap; 38 | va_start(ap, fmt); 39 | fprintf(stderr, "Bliss fatal error: "); 40 | vfprintf(stderr, fmt, ap); 41 | fprintf(stderr, "\nAborting!\n"); 42 | va_end(ap); 43 | exit(1); 44 | } 45 | 46 | } // namespace bliss_digraphs 47 | 48 | #if defined(__clang__) 49 | #pragma clang diagnostic pop 50 | #elif defined(__GNUC__) 51 | #pragma GCC diagnostic pop 52 | #endif 53 | -------------------------------------------------------------------------------- /src/bliss-includes.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A bliss-includes.h GAP package Digraphs Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-24 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #ifndef DIGRAPHS_SRC_BLISS_INCLUDES_H_ 16 | #define DIGRAPHS_SRC_BLISS_INCLUDES_H_ 17 | 18 | #include "digraphs-config.h" 19 | 20 | #if defined(__clang__) 21 | #pragma clang diagnostic push 22 | #pragma clang diagnostic ignored "-Wformat-nonliteral" 23 | #elif defined(__GNUC__) 24 | #pragma GCC diagnostic push 25 | #pragma GCC diagnostic ignored "-Wformat-nonliteral" 26 | #endif 27 | 28 | // GAP headers 29 | #ifdef DIGRAPHS_WITH_INCLUDED_BLISS 30 | #include "bliss-0.73/bliss_C.h" // for bliss_digraphs_release, . . . 31 | #else 32 | #include "bliss/bliss_C.h" 33 | #define bliss_digraphs_add_edge bliss_add_edge 34 | #define bliss_digraphs_new bliss_new 35 | #define bliss_digraphs_add_vertex bliss_add_vertex 36 | #define bliss_digraphs_find_canonical_labeling bliss_find_canonical_labeling 37 | #define bliss_digraphs_release bliss_release 38 | #define bliss_digraphs_find_automorphisms bliss_find_automorphisms 39 | #endif 40 | 41 | #if defined(__clang__) 42 | #pragma clang diagnostic pop 43 | #elif defined(__GNUC__) 44 | #pragma GCC diagnostic pop 45 | #endif 46 | 47 | #endif // DIGRAPHS_SRC_BLISS_INCLUDES_H_ 48 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/strOrFile.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #ifndef STR_OR_FILE_H 8 | #define STR_OR_FILE_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include 16 | 17 | #include "../lowLevelUtils/stack.h" 18 | #include "strbuf.h" 19 | 20 | #define INPUT_CONTAINER 1 21 | #define OUTPUT_CONTAINER 2 22 | typedef struct 23 | { 24 | strBufP theStr; 25 | FILE *pFile; 26 | int containerType; 27 | stackP ungetBuf; 28 | 29 | } strOrFile; 30 | 31 | typedef strOrFile *strOrFileP; 32 | 33 | strOrFileP sf_New(char *theStr, char *fileName, char *ioMode); 34 | int sf_ValidateStrOrFile(strOrFileP theStrOrFile); 35 | 36 | char sf_getc(strOrFileP theStrOrFile); 37 | int sf_ReadSkipChar(strOrFileP theStrOrFile); 38 | int sf_ReadSkipWhitespace(strOrFileP theStrOrFile); 39 | int sf_ReadSingleDigit(int *digitToRead, strOrFileP theStrOrFile); 40 | int sf_ReadInteger(int *intToRead, strOrFileP theStrOrFile); 41 | int sf_ReadSkipInteger(strOrFileP theStrOrFile); 42 | int sf_ReadSkipLineRemainder(strOrFileP theStrOrFile); 43 | 44 | char sf_ungetc(char theChar, strOrFileP theStrOrFile); 45 | int sf_ungets(char *contentsToUnget, strOrFileP theStrOrFile); 46 | 47 | char *sf_fgets(char *str, int count, strOrFileP theStrOrFile); 48 | 49 | int sf_fputs(char *strToWrite, strOrFileP theStrOrFile); 50 | 51 | char *sf_takeTheStr(strOrFileP theStrOrFile); 52 | 53 | int sf_closeFile(strOrFileP theStrOrFile); 54 | 55 | void sf_Free(strOrFileP *pStrOrFile); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* STR_OR_FILE_H */ 62 | -------------------------------------------------------------------------------- /read.g: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## read.g 4 | ## Copyright (C) 2014 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | InstallGlobalFunction(DIGRAPHS_OmitFromTests, 12 | function() 13 | local omit; 14 | omit := []; 15 | if not DIGRAPHS_IsGrapeLoaded() then 16 | Add(omit, " Graph("); 17 | Add(omit, "(Graph("); 18 | Add(omit, "AsGraph("); 19 | fi; 20 | return omit; 21 | end); 22 | 23 | _NautyTracesInterfaceVersion := 24 | First(PackageInfo("digraphs")[1].Dependencies.SuggestedOtherPackages, 25 | x -> x[1] = "NautyTracesInterface")[2]; 26 | 27 | BindGlobal("DIGRAPHS_NautyAvailable", 28 | IsPackageMarkedForLoading("NautyTracesInterface", 29 | _NautyTracesInterfaceVersion)); 30 | 31 | Unbind(_NautyTracesInterfaceVersion); 32 | 33 | ReadPackage("digraphs", "gap/utils.gi"); 34 | ReadPackage("digraphs", "gap/digraph.gi"); 35 | ReadPackage("digraphs", "gap/constructors.gi"); 36 | ReadPackage("digraphs", "gap/grape.gi"); 37 | ReadPackage("digraphs", "gap/labels.gi"); 38 | ReadPackage("digraphs", "gap/attr.gi"); 39 | ReadPackage("digraphs", "gap/prop.gi"); 40 | ReadPackage("digraphs", "gap/oper.gi"); 41 | ReadPackage("digraphs", "gap/display.gi"); 42 | ReadPackage("digraphs", "gap/isomorph.gi"); 43 | ReadPackage("digraphs", "gap/io.gi"); 44 | ReadPackage("digraphs", "gap/grahom.gi"); 45 | ReadPackage("digraphs", "gap/orbits.gi"); 46 | ReadPackage("digraphs", "gap/cliques.gi"); 47 | ReadPackage("digraphs", "gap/planar.gi"); 48 | ReadPackage("digraphs", "gap/examples.gi"); 49 | ReadPackage("digraphs", "gap/weights.gi"); 50 | -------------------------------------------------------------------------------- /doc/z-chap3.xml: -------------------------------------------------------------------------------- 1 | Operators 2 | 3 |
Operators for digraphs 4 | 5 | digraph1 = digraph2 6 | 7 | = (for digraphs) 8 | returns true if digraph1 and digraph2 have the same 9 | vertices, and DigraphEdges(digraph1) = 10 | DigraphEdges(digraph2), up to some re-ordering of the edge 11 | lists.

12 | 13 | Note that this operator does not compare the vertex labels 14 | of digraph1 and digraph2. 15 | 16 | 17 | digraph1 < digraph2 18 | 19 | < (for digraphs) 20 | 21 | This operator returns true if one of the following holds: 22 | 23 | 24 | 25 | The number n_1 of vertices in digraph1 is less than 26 | the number n_2 of vertices in digraph2; 27 | 28 | 29 | n_1 = n_2, and the number m_1 of edges in 30 | digraph1 is less than the number m_2 of edges in 31 | digraph2; 32 | 33 | 34 | n_1 = n_2, m_1 = m_2, and 35 | DigraphEdges(digraph1) is less than 36 | DigraphEdges(digraph2) after having both of these sets 37 | have been sorted with respect to the lexicographical order. 38 | 39 | 40 | 41 | 42 | 43 | <#Include Label="IsSubdigraph"> 44 | <#Include Label="IsUndirectedSpanningTree"> 45 |

46 |
47 | -------------------------------------------------------------------------------- /gap/planar.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## planar.gd 4 | ## Copyright (C) 2018 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | # The methods in this file utilise the kernel module functions that wrap 12 | # Boyer's reference implementation (in C) of the planarity and subgraph 13 | # homeomorphism algorithms from: 14 | # 15 | # John M. Boyer and Wendy J. Myrvold, On the Cutting Edge: Simplified O(n) 16 | # Planarity by Edge Addition. Journal of Graph Algorithms and Applications, Vol. 17 | # 8, No. 3, pp. 241-273, 2004. 18 | 19 | # Attributes . . . 20 | 21 | DeclareAttribute("PlanarEmbedding", IsDigraph); 22 | DeclareAttribute("OuterPlanarEmbedding", IsDigraph); 23 | DeclareAttribute("KuratowskiPlanarSubdigraph", IsDigraph); 24 | DeclareAttribute("KuratowskiOuterPlanarSubdigraph", IsDigraph); 25 | DeclareAttribute("SubdigraphHomeomorphicToK23", IsDigraph); 26 | DeclareAttribute("SubdigraphHomeomorphicToK4", IsDigraph); 27 | DeclareAttribute("SubdigraphHomeomorphicToK33", IsDigraph); 28 | DeclareAttribute("DualPlanarGraph", IsDigraph); 29 | 30 | # Properties . . . 31 | 32 | DeclareProperty("IsPlanarDigraph", IsDigraph); 33 | DeclareProperty("IsOuterPlanarDigraph", IsDigraph); 34 | 35 | # True methods . . . 36 | 37 | InstallTrueMethod(IsBiconnectedDigraph, 38 | IsOuterPlanarDigraph and IsHamiltonianDigraph); 39 | InstallTrueMethod(IsHamiltonianDigraph, 40 | IsOuterPlanarDigraph and IsBiconnectedDigraph); 41 | InstallTrueMethod(IsPlanarDigraph, IsChainDigraph); 42 | InstallTrueMethod(IsPlanarDigraph, IsCycleDigraph); 43 | InstallTrueMethod(IsPlanarDigraph, IsOuterPlanarDigraph); 44 | -------------------------------------------------------------------------------- /src/schreier-sims.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A schreier-sims.h A rudimentary Schreier-Sims Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-15 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #ifndef DIGRAPHS_SRC_SCHREIER_SIMS_H_ 16 | #define DIGRAPHS_SRC_SCHREIER_SIMS_H_ 17 | 18 | // C headers 19 | #include // for bool 20 | #include // for uint16_t 21 | 22 | // Digraphs headers 23 | #include "perms.h" // for Perm, PermColl 24 | 25 | extern uint16_t PERM_DEGREE; 26 | 27 | struct schreier_sims_struct { 28 | uint16_t degree; 29 | PermColl** strong_gens; // strong generators 30 | Perm* transversal; 31 | Perm* inversal; 32 | bool* orb_lookup; 33 | uint16_t* orbits; 34 | uint16_t* size_orbits; 35 | uint16_t* base; 36 | Perm tmp_perm; 37 | uint16_t size_base; 38 | }; 39 | 40 | typedef struct schreier_sims_struct SchreierSims; 41 | 42 | SchreierSims* new_schreier_sims(void); 43 | void free_schreier_sims(SchreierSims* ss); 44 | 45 | // Store the stabiliser of pt in the group generated by src, in dst, use ss to 46 | // hold the stabiliser chain. 47 | void point_stabilizer(SchreierSims* ss, 48 | PermColl* src, 49 | PermColl* dst, 50 | uint16_t const pt); 51 | 52 | #endif // DIGRAPHS_SRC_SCHREIER_SIMS_H_ 53 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/lowLevelUtils/apiutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "apiutils.h" 13 | #include "appconst.h" 14 | 15 | int quietMode = FALSE; 16 | 17 | int getQuietModeSetting(void) 18 | { 19 | return quietMode; 20 | } 21 | 22 | void setQuietModeSetting(int newQuietModeSetting) 23 | { 24 | quietMode = newQuietModeSetting; 25 | } 26 | 27 | void Message(char *message) 28 | { 29 | if (!getQuietModeSetting()) 30 | { 31 | fprintf(stdout, "%s", message); 32 | fflush(stdout); 33 | } 34 | } 35 | 36 | void ErrorMessage(char *message) 37 | { 38 | if (!getQuietModeSetting()) 39 | { 40 | fprintf(stderr, "%s", message); 41 | fflush(stderr); 42 | } 43 | } 44 | 45 | int GetNumCharsToReprInt(int theNum, int *numCharsRequired) 46 | { 47 | if (numCharsRequired == NULL) 48 | return NOTOK; 49 | 50 | int charCount = 0; 51 | 52 | if (theNum < 0) 53 | { 54 | charCount++; 55 | // N.B. since 32-bit signed integers are represented using twos-complement, 56 | // the absolute value of INT_MIN is not defined; however, adding 1 to this 57 | // min value before taking the absolute value will still require the same 58 | // number of digits. 59 | if ((theNum == INT_MIN) || (theNum == INT8_MAX) || (theNum == INT16_MIN) || (theNum == INT32_MIN)) 60 | theNum++; 61 | theNum = abs(theNum); 62 | } 63 | 64 | while (theNum > 0) 65 | { 66 | theNum /= 10; 67 | charCount++; 68 | } 69 | 70 | (*numCharsRequired) = charCount; 71 | 72 | return OK; 73 | } 74 | -------------------------------------------------------------------------------- /gap/labels.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## labels.gd 4 | ## Copyright (C) 2019 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | ## Vertex labels 12 | 13 | # Get vertex labels 14 | DeclareOperation("DigraphVertexLabel", [IsDigraph, IsPosInt]); 15 | DeclareOperation("DigraphVertexLabels", [IsDigraph]); 16 | DeclareOperation("HaveVertexLabelsBeenAssigned", [IsDigraph]); 17 | 18 | # Set vertex labels 19 | DeclareOperation("SetDigraphVertexLabel", [IsDigraph, IsPosInt, IsObject]); 20 | DeclareOperation("SetDigraphVertexLabels", [IsDigraph, IsList]); 21 | 22 | # Unset vertex labels 23 | # TODO document these two operations 24 | DeclareOperation("RemoveDigraphVertexLabel", [IsDigraph, IsPosInt]); 25 | DeclareOperation("ClearDigraphVertexLabels", [IsDigraph]); 26 | 27 | ## Edge labels 28 | 29 | # Get edge labels 30 | DeclareOperation("DigraphEdgeLabel", [IsDigraph, IsPosInt, IsPosInt]); 31 | DeclareOperation("DigraphEdgeLabels", [IsDigraph]); 32 | DeclareOperation("DigraphEdgeLabelsNC", [IsDigraph]); 33 | DeclareOperation("HaveEdgeLabelsBeenAssigned", [IsDigraph]); 34 | 35 | # Set edge labels 36 | DeclareOperation("SetDigraphEdgeLabel", 37 | [IsDigraph, IsPosInt, IsPosInt, IsObject]); 38 | DeclareOperation("SetDigraphEdgeLabels", [IsDigraph, IsFunction]); 39 | DeclareOperation("SetDigraphEdgeLabels", [IsDigraph, IsList]); 40 | DeclareOperation("SetDigraphEdgeLabelsNC", [IsDigraph, IsList]); 41 | 42 | # Unset edge labels 43 | # TODO document these two operations 44 | DeclareOperation("RemoveDigraphEdgeLabel", [IsDigraph, IsPosInt, IsPosInt]); 45 | DeclareOperation("ClearDigraphEdgeLabels", [IsDigraph]); 46 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/homeomorphSearch/graphK4Search.private.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_K4SEARCH_PRIVATE_H 2 | #define GRAPH_K4SEARCH_PRIVATE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graph.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | /* Additional equipment for each EdgeRec 18 | 19 | pathConnector: 20 | Used in the edge records (arcs) of a reduction edge to indicate the 21 | endpoints of a path that has been reduced from (removed from) the 22 | embedding so that the search for a K4 can continue. 23 | We only need a pathConnector because we reduce subgraphs that are 24 | separable by a 2-cut, so they can contribute at most one path to a 25 | subgraph homeomorphic to K4, if one is indeed found. Thus, we first 26 | delete all edges except for the desired path(s), then we reduce any 27 | retained path to an edge. 28 | */ 29 | typedef struct 30 | { 31 | int pathConnector; 32 | } K4Search_EdgeRec; 33 | 34 | typedef K4Search_EdgeRec *K4Search_EdgeRecP; 35 | 36 | /* Additional equipment for each vertex: None */ 37 | 38 | typedef struct 39 | { 40 | // Helps distinguish initialize from re-initialize 41 | int initialized; 42 | 43 | // The graph that this context augments 44 | graphP theGraph; 45 | 46 | // Parallel array for additional edge level equipment 47 | K4Search_EdgeRecP E; 48 | 49 | // Overloaded function pointers 50 | graphFunctionTable functions; 51 | 52 | // Internal variable for converting a tail recursion into a simple loop 53 | int handlingBlockedBicomp; 54 | 55 | } K4SearchContext; 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/samples/Makefile.am: -------------------------------------------------------------------------------- 1 | samplesdir = @docdir@/samples 2 | 3 | dist_samples_DATA = \ 4 | drawExample.0-based.txt \ 5 | drawExample.0-based.txt.ColorVertices.out.txt \ 6 | drawExample.0-based.txt.DrawPlanar.out.txt \ 7 | drawExample.0-based.txt.DrawPlanar.out.txt.render.txt \ 8 | drawExample.txt \ 9 | drawExample.txt.ColorVertices.out.txt \ 10 | drawExample.txt.DrawPlanar.out.txt \ 11 | drawExample.txt.DrawPlanar.out.txt.render.txt \ 12 | K10.g6 \ 13 | K10.g6.0-based.AdjList.out.txt \ 14 | K10.g6.0-based.AdjList.out.txt.0-based.G6.out.g6 \ 15 | K10.g6.0-based.AdjMat.out.txt \ 16 | maxPlanar5.0-based.txt \ 17 | maxPlanar5.0-based.txt.ColorVertices.out.txt \ 18 | maxPlanar5.0-based.txt.DrawPlanar.out.txt \ 19 | maxPlanar5.0-based.txt.DrawPlanar.out.txt.render.txt \ 20 | maxPlanar5.0-based.txt.PlanarEmbed.out.txt \ 21 | maxPlanar5.txt \ 22 | maxPlanar5.txt.ColorVertices.out.txt \ 23 | maxPlanar5.txt.DrawPlanar.out.txt \ 24 | maxPlanar5.txt.DrawPlanar.out.txt.render.txt \ 25 | maxPlanar5.txt.PlanarEmbed.out.txt \ 26 | N5-all.g6 \ 27 | N5-all.g6.0-based.AdjList.out.txt \ 28 | N5-all.g6.0-based.AdjMat.out.txt \ 29 | nauty_example.g6 \ 30 | nauty_example.g6.0-based.AdjList.out.txt \ 31 | nauty_example.g6.0-based.AdjList.out.txt.0-based.G6.out.g6 \ 32 | nauty_example.g6.0-based.AdjMat.out.txt \ 33 | Petersen.0-based.txt \ 34 | Petersen.0-based.txt.ColorVertices.out.txt \ 35 | Petersen.0-based.txt.K23Search.out.txt \ 36 | Petersen.0-based.txt.K33Search.out.txt \ 37 | Petersen.0-based.txt.K4Search.out.txt \ 38 | Petersen.0-based.txt.OuterplanarEmbed.out.txt \ 39 | Petersen.0-based.txt.PlanarEmbed.out.txt \ 40 | Petersen.txt \ 41 | Petersen.txt.ColorVertices.out.txt \ 42 | Petersen.txt.K23Search.out.txt \ 43 | Petersen.txt.K33Search.out.txt \ 44 | Petersen.txt.K4Search.out.txt \ 45 | Petersen.txt.OuterplanarEmbed.out.txt \ 46 | Petersen.txt.PlanarEmbed.out.txt -------------------------------------------------------------------------------- /m4/ax_append_compile_flags.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================ 2 | # https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html 3 | # ============================================================================ 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # For every FLAG1, FLAG2 it is checked whether the compiler works with the 12 | # flag. If it does, the flag is added FLAGS-VARIABLE 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. During the check the flag is always added to the 16 | # current language's flags. 17 | # 18 | # If EXTRA-FLAGS is defined, it is added to the current language's default 19 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 20 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 21 | # force the compiler to issue an error when a bad flag is given. 22 | # 23 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 24 | # 25 | # NOTE: This macro depends on the AX_APPEND_FLAG and 26 | # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with 27 | # AX_APPEND_LINK_FLAGS. 28 | # 29 | # LICENSE 30 | # 31 | # Copyright (c) 2011 Maarten Bosmans 32 | # 33 | # Copying and distribution of this file, with or without modification, are 34 | # permitted in any medium without royalty provided the copyright notice 35 | # and this notice are preserved. This file is offered as-is, without any 36 | # warranty. 37 | 38 | #serial 7 39 | 40 | AC_DEFUN([AX_APPEND_COMPILE_FLAGS], 41 | [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) 42 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 43 | for flag in $1; do 44 | AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) 45 | done 46 | ])dnl AX_APPEND_COMPILE_FLAGS 47 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/lowLevelUtils/platformTime.h: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORM_TIME 2 | #define PLATFORM_TIME 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | // NOTE: Since platformTime.h is only #include'd by appconst.h, and since appconst.h 11 | // #define's WINDOWS before including platformTime.h, we condition on WINDOWS being defined. 12 | #ifdef WINDOWS 13 | 14 | #include 15 | #include 16 | 17 | #define platform_time DWORD 18 | #define platform_GetTime(timeVar) (timeVar = GetTickCount()) 19 | #define platform_GetDuration(startTime, endTime) ((double)(endTime - startTime) / 1000.0) 20 | 21 | #else 22 | 23 | #include 24 | 25 | typedef struct 26 | { 27 | clock_t hiresTime; 28 | time_t lowresTime; 29 | } platform_time; 30 | 31 | #define platform_GetTime(timeVar) (timeVar.hiresTime = clock(), timeVar.lowresTime = time(NULL)) 32 | 33 | // Many flavors of Unix have CLOCKS_PER_SEC at 1 million, and clock_t as a 4 byte long integer 34 | // which means that the clock() construct has a resolution of only about 2000 seconds 35 | // If we're getting a duration longer than that, then we fall back to the coarser time() measure 36 | 37 | #define platform_GetDuration(startTime, endTime) ( \ 38 | ((double)(endTime.lowresTime - startTime.lowresTime)) > 2000 ? ((double)(endTime.lowresTime - startTime.lowresTime)) : ((double)(endTime.hiresTime - startTime.hiresTime)) / CLOCKS_PER_SEC) 39 | 40 | /* 41 | #define platform_time clock_t 42 | #define platform_GetTime() clock() 43 | #define platform_GetDuration(startTime, endTime) (((double) (endTime - startTime)) / CLOCKS_PER_SEC) 44 | */ 45 | 46 | /* 47 | #define platform_time time_t 48 | #define platform_GetTime() time((time_t *)NULL) 49 | #define platform_GetDuration(startTime, endTime) ((double) (endTime - startTime)) 50 | */ 51 | 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tst/workspaces/save-workspace.tst: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W workspaces/save-workspace.tst 4 | #Y Copyright (C) 2017 Wilf A. Wilson 5 | ## Michael Young 6 | ## 7 | ## Licensing information can be found in the README file of this package. 8 | ## 9 | ############################################################################# 10 | ## 11 | ## This file, together with load-workspace.tst, tests the ability to save 12 | ## and load workspaces which include Digraph objects. Objects should be 13 | ## created and stored in save-workspace.tst, and then loaded and tested in 14 | ## load-workspace.tst to ensure that they work correctly after being saved. 15 | ## 16 | ############################################################################# 17 | 18 | # Set up testing environment 19 | 20 | #@local gr 21 | gap> START_TEST("Digraphs package: workspaces/save-workspace.tst"); 22 | gap> SetInfoLevel(InfoDebug, 0); 23 | gap> LoadPackage("digraphs", false);; 24 | gap> DIGRAPHS_StartTest(); 25 | 26 | ############################################################################# 27 | ## Create objects below here, and add tests to load-workspace.tst to ensure 28 | ## that they are saved to disk correctly. Do not reuse variable names. 29 | ############################################################################# 30 | 31 | # Temporary 32 | gap> gr := Digraph([[1]]); 33 | 34 | 35 | ############################################################################# 36 | ## Tests end here 37 | ############################################################################# 38 | 39 | # Save the workspace 40 | gap> SaveWorkspace(Concatenation(DIGRAPHS_Dir(), 41 | > "/tst/workspaces/test-output.w")); 42 | true 43 | 44 | # 45 | gap> STOP_TEST("Digraphs package: workspaces/save-workspace.tst", 0); 46 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/g6-read-iterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #ifndef G6_READ_ITERATOR 8 | #define G6_READ_ITERATOR 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | #include "../graph.h" 19 | #include "strOrFile.h" 20 | 21 | typedef struct 22 | { 23 | strOrFileP g6Input; 24 | int numGraphsRead; 25 | 26 | int graphOrder; 27 | int numCharsForGraphOrder; 28 | int numCharsForGraphEncoding; 29 | int currGraphBuffSize; 30 | char *currGraphBuff; 31 | 32 | graphP currGraph; 33 | } G6ReadIterator; 34 | 35 | int allocateG6ReadIterator(G6ReadIterator **, graphP); 36 | bool _isG6ReadIteratorAllocated(G6ReadIterator *); 37 | 38 | int getNumGraphsRead(G6ReadIterator *, int *); 39 | int getOrderOfGraphToRead(G6ReadIterator *, int *); 40 | int getPointerToGraphReadIn(G6ReadIterator *, graphP *); 41 | 42 | int beginG6ReadIterationFromG6StrOrFile(G6ReadIterator *, strOrFileP); 43 | int _beginG6ReadIteration(G6ReadIterator *); 44 | int _processAndCheckHeader(strOrFileP); 45 | bool _firstCharIsValid(char, const int); 46 | int _getGraphOrder(strOrFileP, int *); 47 | 48 | int readGraphUsingG6ReadIterator(G6ReadIterator *); 49 | int _checkGraphOrder(char *, int); 50 | int _validateGraphEncoding(char *, const int, const int); 51 | int _decodeGraph(char *, const int, const int, graphP); 52 | 53 | int endG6ReadIteration(G6ReadIterator *); 54 | 55 | int freeG6ReadIterator(G6ReadIterator **); 56 | 57 | int _ReadGraphFromG6FilePath(graphP, char *); 58 | int _ReadGraphFromG6String(graphP, char *); 59 | int _ReadGraphFromG6StrOrFile(graphP, strOrFileP); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* G6_READ_ITERATOR */ 66 | -------------------------------------------------------------------------------- /extern/bliss-0.73/timer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "timer.hh" 4 | 5 | /* 6 | Copyright (c) 2003-2015 Tommi Junttila 7 | Released under the GNU Lesser General Public License version 3. 8 | 9 | This file is part of bliss. 10 | 11 | bliss is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU Lesser General Public License as published by 13 | the Free Software Foundation, version 3 of the License. 14 | 15 | bliss is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with bliss. If not, see . 22 | */ 23 | 24 | #if defined(__clang__) 25 | #pragma clang diagnostic push 26 | #pragma clang diagnostic ignored "-Wold-style-cast" 27 | #elif defined(__GNUC__) 28 | #pragma GCC diagnostic push 29 | #pragma GCC diagnostic ignored "-Wold-style-cast" 30 | #pragma GCC diagnostic ignored "-Wuninitialized" 31 | #endif 32 | 33 | namespace bliss_digraphs { 34 | 35 | static const double numTicksPerSec = (double)(sysconf(_SC_CLK_TCK)); 36 | 37 | Timer::Timer() 38 | { 39 | reset(); 40 | } 41 | 42 | void Timer::reset() 43 | { 44 | struct tms clkticks; 45 | 46 | // times(&clkticks); 47 | start_time = 48 | ((double) clkticks.tms_utime + (double) clkticks.tms_stime) / 49 | numTicksPerSec; 50 | } 51 | 52 | 53 | double Timer::get_duration() 54 | { 55 | struct tms clkticks; 56 | 57 | // times(&clkticks); 58 | double intermediate = 59 | ((double) clkticks.tms_utime + (double) clkticks.tms_stime) / 60 | numTicksPerSec; 61 | return intermediate - start_time; 62 | } 63 | 64 | } // namespace bliss_digraphs 65 | #if defined(__clang__) 66 | #pragma clang diagnostic pop 67 | #elif defined(__GNUC__) 68 | #pragma GCC diagnostic pop 69 | #endif 70 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/graphLib.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHLIB_H 2 | #define GRAPHLIB_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "graph.h" 21 | 22 | #include "lowLevelUtils/platformTime.h" 23 | 24 | #include "homeomorphSearch/graphK23Search.h" 25 | #include "homeomorphSearch/graphK33Search.h" 26 | #include "homeomorphSearch/graphK4Search.h" 27 | #include "planarityRelated/graphDrawPlanar.h" 28 | 29 | // This is the main location for the project and shared library version numbering. 30 | // Changes here must be mirrored in configure.ac 31 | // 32 | // The overall project version numbering format is major.minor.maintenance.tweak 33 | // Major is for an overhaul (e.g. many features, data structure change, change of backward compatibility) 34 | // Minor is for feature addition (e.g. a new algorithm implementation added, new interface) 35 | // Maintenance is for functional revision (e.g. bug fix to existing algorithm implementation) 36 | // Tweak is for a non-functional revision (e.g. change of build scripts or testing code, user-facing string changes) 37 | 38 | #define GP_PROJECTVERSION_MAJOR 4 39 | #define GP_PROJECTVERSION_MINOR 0 40 | #define GP_PROJECTVERSION_MAINT 0 41 | #define GP_PROJECTVERSION_TWEAK 0 42 | 43 | char *gp_GetProjectVersionFull(void); 44 | 45 | // Any change to the project version numbers should also affect the 46 | // shared library version numbers below. 47 | // 48 | // See configure.ac for how to update these version numbers 49 | #define GP_LIBPLANARITYVERSION_CURRENT 2 50 | #define GP_LIBPLANARITYVERSION_REVISION 0 51 | #define GP_LIBPLANARITYVERSION_AGE 0 52 | 53 | char *gp_GetLibPlanarityVersionFull(void); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/.gitignore: -------------------------------------------------------------------------------- 1 | # Directories 2 | **/Release/ 3 | **/Debug/ 4 | /c/.settings/ 5 | 6 | # Ignore directories for output of Random Graphs 7 | **/random/ 8 | **/embedded/ 9 | **/adjlist/ 10 | **/obstructed/ 11 | **/error/ 12 | 13 | # Object files 14 | *.o 15 | *.ko 16 | *.obj 17 | *.elf 18 | 19 | # Precompiled Headers 20 | *.gch 21 | *.pch 22 | 23 | # Libraries 24 | *.lib 25 | *.a 26 | *.la 27 | *.lo 28 | 29 | # Shared objects (inc. Windows DLLs) 30 | *.dll 31 | *.so 32 | *.so.* 33 | *.dylib 34 | 35 | # Executables 36 | *.exe 37 | *.out 38 | *.app 39 | *.i*86 40 | *.x86_64 41 | *.hex 42 | 43 | # Linker output 44 | *.ilk 45 | *.map 46 | *.exp 47 | 48 | # Debug files 49 | *.dSYM/ 50 | *.su 51 | *.idb 52 | *.pdb 53 | 54 | # Java 55 | *.class 56 | *.log 57 | *.jar 58 | *.war 59 | *.ear 60 | *.zip 61 | *.tar.gz 62 | *.rar 63 | 64 | # To ignore files generated by the make distribution process 65 | *.tar.gz 66 | **/.deps/ 67 | /autom4te.cache/ 68 | libtool 69 | test-samples.sh 70 | Makefile 71 | config.status 72 | config.guess* 73 | config.sub* 74 | depcomp 75 | install-sh* 76 | Makefile.in 77 | missing 78 | ltmain.sh 79 | configure 80 | configure~ 81 | aclocal.m4 82 | compile 83 | test-driver 84 | planarity-* 85 | planarity-*/* 86 | libplanarity.pc 87 | m4/ 88 | 89 | # Ignoring configuration for VSCode 90 | /.vscode/ 91 | 92 | # Ignoring configuration for Eclipse project 93 | .project 94 | /c/.project 95 | /c/.cproject 96 | 97 | ## MacOS excludes 98 | .DS_Store 99 | 100 | # Ignore binary produced by compiling on MacOS 101 | planarity 102 | 103 | # Ignore planaritytesting Package default output directories, pycache, 104 | # .pylintrc, and configuration file for leaks orchestrator 105 | TestSupport/planaritytesting/__pycache__/ 106 | TestSupport/results/ 107 | TestSupport/g6_diff_finder_logs/ 108 | TestSupport/planaritytesting/.pylintrc 109 | TestSupport/planaritytesting/leaksorchestrator/planarity_leaks_config.ini 110 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/strbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #ifndef STRBUF_H 8 | #define STRBUF_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | // includes mem functions like memcpy 16 | #include 17 | 18 | typedef struct 19 | { 20 | char *buf; 21 | int size, capacity, readPos; 22 | } strBuf; 23 | 24 | typedef strBuf *strBufP; 25 | 26 | strBufP sb_New(int); 27 | void sb_Free(strBufP *); 28 | 29 | void sb_ClearBuf(strBufP); 30 | int sb_Copy(strBufP, strBufP); 31 | strBufP sb_Duplicate(strBufP); 32 | 33 | #define sb_GetFullString(theStrBuf) (theStrBuf->buf) 34 | #define sb_GetSize(theStrBuf) (theStrBuf->size) 35 | #define sb_GetCapacity(theStrBuf) (theStrBuf->capacity) 36 | #define sb_GetUnreadCharCount(theStrBuf) (theStrBuf->size - theStrBuf->readPos) 37 | #define sb_GetReadString(theStrBuf) ((theStrBuf != NULL && theStrBuf->buf != NULL) ? (theStrBuf->buf + theStrBuf->readPos) : NULL) 38 | 39 | #define sb_GetReadPos(theStrBuf) (theStrBuf->readPos) 40 | #define sb_SetReadPos(theStrBuf, theReadPos) \ 41 | { \ 42 | theStrBuf->readPos = theReadPos; \ 43 | } 44 | 45 | void sb_ReadSkipWhitespace(strBufP); 46 | void sb_ReadSkipInteger(strBufP); 47 | #define sb_ReadSkipChar(theStrBuf) \ 48 | { \ 49 | theStrBuf->readPos++; \ 50 | } 51 | 52 | int sb_ConcatString(strBufP, char *); 53 | int sb_ConcatChar(strBufP, char); 54 | 55 | char *sb_TakeString(strBufP); 56 | 57 | #ifndef SPEED_MACROS 58 | // Optimized SPEED_MACROS versions of larger methods are not used in this module 59 | #else 60 | // Optimized SPEED_MACROS versions of larger methods are not used in this module 61 | #endif 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* STRBUF_H */ 68 | -------------------------------------------------------------------------------- /gap/digraphs.g: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## digraphs.g 4 | ## Copyright (C) 2014-19 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | DeclareOperation("DeclareAttributeThatReturnsDigraph", [IsString, IsOperation]); 12 | DeclareOperation("InstallMethodThatReturnsDigraph", 13 | [IsOperation, IsString, IsList, IsFunction]); 14 | 15 | InstallMethod(DeclareAttributeThatReturnsDigraph, "for a string", 16 | [IsString, IsOperation], 17 | function(oper_name, filt) 18 | local attr_name, has_attr_name, oper, attr, has_attr; 19 | 20 | attr_name := Concatenation(oper_name, "Attr"); 21 | has_attr_name := Concatenation("Has", attr_name); 22 | 23 | DeclareOperation(oper_name, [filt]); 24 | DeclareAttribute(attr_name, filt); 25 | 26 | oper := ValueGlobal(oper_name); 27 | attr := ValueGlobal(attr_name); 28 | has_attr := ValueGlobal(has_attr_name); 29 | 30 | InstallMethod(oper, Concatenation("for a digraph with ", has_attr_name), 31 | [IsDigraph and has_attr], SUM_FLAGS, attr); 32 | InstallMethod(attr, "for an immutable digraph", [IsImmutableDigraph], oper); 33 | # Now it suffices to install a method for the oper and a subcategory of 34 | # filt and this ought to just work. 35 | end); 36 | 37 | InstallMethod(InstallMethodThatReturnsDigraph, 38 | "for an operation, info string, list of argument filters, and function", 39 | [IsOperation, IsString, IsList, IsFunction], 40 | function(oper, info, filt, func) 41 | InstallMethod(oper, info, filt, 42 | function(D) 43 | local C, attr_name, set_attr; 44 | C := func(D); 45 | if IsImmutableDigraph(D) then 46 | if not IsImmutableDigraph(C) then 47 | MakeImmutable(C); 48 | fi; 49 | attr_name := Concatenation(NameFunction(oper), "Attr"); 50 | set_attr := ValueGlobal(Concatenation("Set", attr_name)); 51 | set_attr(D, C); 52 | fi; 53 | return C; 54 | end); 55 | end); 56 | -------------------------------------------------------------------------------- /gap/cliques.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## cliques.gd 4 | ## Copyright (C) 2015-17 Markus Pfeiffer 5 | ## Raghav Mehra 6 | ## Wilf A. Wilson 7 | ## 8 | ## Licensing information can be found in the README file of this package. 9 | ## 10 | ############################################################################# 11 | ## 12 | 13 | DeclareOperation("IsIndependentSet", [IsDigraph, IsHomogeneousList]); 14 | DeclareOperation("IsMaximalIndependentSet", [IsDigraph, IsHomogeneousList]); 15 | DeclareOperation("IsClique", [IsDigraph, IsHomogeneousList]); 16 | DeclareOperation("IsMaximalClique", [IsDigraph, IsHomogeneousList]); 17 | 18 | # Functions to calculate cliques 19 | DeclareGlobalFunction("CliquesFinder"); 20 | DeclareGlobalFunction("DIGRAPHS_BronKerbosch"); 21 | 22 | DeclareGlobalFunction("DigraphClique"); 23 | DeclareGlobalFunction("DigraphMaximalClique"); 24 | DeclareGlobalFunction("DIGRAPHS_Clique"); 25 | 26 | DeclareGlobalFunction("DigraphCliques"); 27 | DeclareGlobalFunction("DigraphCliquesReps"); 28 | DeclareGlobalFunction("DigraphMaximalCliques"); 29 | DeclareGlobalFunction("DigraphMaximalCliquesReps"); 30 | DeclareAttribute("DigraphCliquesAttr", IsDigraph); 31 | DeclareAttribute("DigraphMaximalCliquesAttr", IsDigraph); 32 | DeclareAttribute("DigraphMaximalCliquesRepsAttr", IsDigraph); 33 | 34 | # Functions to calculate independent sets 35 | DeclareGlobalFunction("DigraphIndependentSet"); 36 | DeclareGlobalFunction("DigraphMaximalIndependentSet"); 37 | 38 | DeclareGlobalFunction("DigraphIndependentSets"); 39 | DeclareGlobalFunction("DigraphIndependentSetsReps"); 40 | DeclareGlobalFunction("DigraphMaximalIndependentSets"); 41 | DeclareGlobalFunction("DigraphMaximalIndependentSetsReps"); 42 | DeclareAttribute("DigraphIndependentSetsAttr", IsDigraph); 43 | DeclareAttribute("DigraphMaximalIndependentSetsAttr", IsDigraph); 44 | DeclareAttribute("DigraphMaximalIndependentSetsRepsAttr", IsDigraph); 45 | 46 | DeclareAttribute("CliqueNumber", IsDigraph); 47 | -------------------------------------------------------------------------------- /src/conditions.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | ** conditions.c - Data structure for homomorphisms search J. D. Mitchell 4 | ** 5 | ** Copyright (C) 2019 - J. D. Mitchell 6 | ** 7 | ** This file is free software, see the digraphs/LICENSE. 8 | ** 9 | ********************************************************************************/ 10 | 11 | #include "conditions.h" 12 | 13 | // C headers 14 | #include // for true, false 15 | #include // for uint16_t, uint64_t 16 | #include // for free, malloc 17 | 18 | // Digraphs headers 19 | #include "digraphs-debug.h" // for DIGRAPHS_ASSERT 20 | #include "safemalloc.h" 21 | 22 | Conditions* new_conditions(uint16_t const nr1, uint16_t const nr2) { 23 | DIGRAPHS_ASSERT(nr1 != 0); 24 | DIGRAPHS_ASSERT(nr2 != 0); 25 | Conditions* conditions = safe_malloc(sizeof(Conditions)); 26 | 27 | conditions->bit_array = safe_malloc(sizeof(BitArray*) * nr1 * nr1); 28 | conditions->changed = safe_malloc(nr1 * (nr1 + 1) * sizeof(uint16_t)); 29 | conditions->height = safe_malloc(nr1 * sizeof(uint16_t)); 30 | conditions->sizes = safe_malloc(nr1 * nr1 * sizeof(uint16_t)); 31 | conditions->size = (uint64_t) nr1 * nr1; 32 | 33 | conditions->nr1 = nr1; 34 | conditions->nr2 = nr2; 35 | 36 | for (uint64_t i = 0; i < conditions->size; i++) { 37 | conditions->bit_array[i] = new_bit_array(nr2); 38 | } 39 | 40 | for (uint64_t i = 0; i < nr1; i++) { 41 | init_bit_array(conditions->bit_array[i], true, nr1); 42 | conditions->changed[i + 1] = i; 43 | conditions->changed[(nr1 + 1) * i] = 0; 44 | conditions->height[i] = 1; 45 | } 46 | conditions->changed[0] = nr1; 47 | return conditions; 48 | } 49 | 50 | void free_conditions(Conditions* const conditions) { 51 | DIGRAPHS_ASSERT(conditions != NULL); 52 | for (uint64_t i = 0; i < conditions->size; i++) { 53 | free_bit_array(conditions->bit_array[i]); 54 | } 55 | free(conditions->bit_array); 56 | free(conditions->changed); 57 | free(conditions->height); 58 | free(conditions->sizes); 59 | free(conditions); 60 | } 61 | -------------------------------------------------------------------------------- /tst/standard/orbits.tst: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W standard/orbits.tst 4 | #Y Copyright (C) 2014-17 Wilf A. Wilson 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | #@local gr 12 | gap> START_TEST("Digraphs package: standard/orbits.tst"); 13 | gap> LoadPackage("digraphs", false);; 14 | 15 | # 16 | gap> DIGRAPHS_StartTest(); 17 | 18 | # DigraphStabilizer, error 19 | gap> gr := NullDigraph(0); 20 | 21 | gap> DigraphStabilizer(gr, 1); 22 | Error, the 2nd argument must not exceed 23 | 0, the number of vertices of the digraph in the 1st argument , 24 | 25 | # DigraphStabilizer, 26 | gap> gr := CompleteDigraph(3); 27 | 28 | gap> DigraphStabilizer(gr, 1); 29 | Group([ (2,3) ]) 30 | gap> DigraphStabilizer(gr, 2); 31 | Group([ (1,3) ]) 32 | gap> DigraphStabilizer(gr, 3); 33 | Group([ (1,2) ]) 34 | 35 | # DigraphGroup 36 | gap> gr := Digraph([[2, 3], [1], [2]]); 37 | 38 | gap> DigraphGroup(gr); 39 | Group(()) 40 | gap> gr := Digraph([[3], [3], [1, 2, 3]]); 41 | 42 | gap> Size(AutomorphismGroup(gr)); 43 | 2 44 | gap> gr := Digraph([[3, 2], [1], [1]]); 45 | 46 | gap> DigraphGroup(gr); 47 | Group([ (2,3) ]) 48 | 49 | # DigraphOrbits 50 | gap> gr := CycleDigraph(10); 51 | 52 | gap> DigraphOrbits(gr); 53 | [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ] 54 | 55 | # RepresentativeOutNeighbours 56 | gap> gr := ChainDigraph(3); 57 | 58 | gap> RepresentativeOutNeighbours(gr); 59 | [ [ 2 ], [ 3 ], [ ] ] 60 | gap> gr := CycleDigraph(12); 61 | 62 | gap> RepresentativeOutNeighbours(gr); 63 | [ [ 2 ] ] 64 | 65 | # 66 | gap> DIGRAPHS_StopTest(); 67 | gap> STOP_TEST("Digraphs package: standard/orbits.tst", 0); 68 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/io/g6-write-iterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #ifndef G6_WRITE_ITERATOR 8 | #define G6_WRITE_ITERATOR 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | #include "../graph.h" 19 | #include "strOrFile.h" 20 | 21 | typedef struct 22 | { 23 | strOrFileP g6Output; 24 | int numGraphsWritten; 25 | 26 | int graphOrder; 27 | int numCharsForGraphOrder; 28 | int numCharsForGraphEncoding; 29 | int currGraphBuffSize; 30 | char *currGraphBuff; 31 | 32 | int *columnOffsets; 33 | 34 | graphP currGraph; 35 | } G6WriteIterator; 36 | 37 | int allocateG6WriteIterator(G6WriteIterator **, graphP); 38 | bool _isG6WriteIteratorAllocated(G6WriteIterator *); 39 | 40 | int getNumGraphsWritten(G6WriteIterator *, int *); 41 | int getOrderOfGraphToWrite(G6WriteIterator *, int *); 42 | int getPointerToGraphToWrite(G6WriteIterator *, graphP *); 43 | 44 | int beginG6WriteIterationToG6StrOrFile(G6WriteIterator *pG6WriteIterator, strOrFileP outputContainer); 45 | int _beginG6WriteIteration(G6WriteIterator *pG6WriteIterator); 46 | void _precomputeColumnOffsets(int *, int); 47 | 48 | int writeGraphUsingG6WriteIterator(G6WriteIterator *); 49 | 50 | int _encodeAdjMatAsG6(G6WriteIterator *); 51 | int _getFirstEdge(graphP, int *, int *, int *); 52 | int _getNextEdge(graphP, int *, int *, int *); 53 | int _getNextInUseEdge(graphP theGraph, int *e, int *u, int *v); 54 | 55 | int _printEncodedGraph(G6WriteIterator *); 56 | 57 | int endG6WriteIteration(G6WriteIterator *); 58 | 59 | int freeG6WriteIterator(G6WriteIterator **); 60 | 61 | int _WriteGraphToG6FilePath(graphP pGraph, char *g6OutputFilename); 62 | int _WriteGraphToG6String(graphP pGraph, char **g6OutputStr); 63 | int _WriteGraphToG6StrOrFile(graphP pGraph, strOrFileP outputContainer, char **outputStr); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* G6_WRITE_ITERATOR */ 70 | -------------------------------------------------------------------------------- /extern/bliss-0.73/heap.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "defs.hh" 5 | #include "heap.hh" 6 | 7 | /* 8 | Copyright (c) 2003-2015 Tommi Junttila 9 | Released under the GNU Lesser General Public License version 3. 10 | 11 | This file is part of bliss. 12 | 13 | bliss is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU Lesser General Public License as published by 15 | the Free Software Foundation, version 3 of the License. 16 | 17 | bliss is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU Lesser General Public License for more details. 21 | 22 | You should have received a copy of the GNU Lesser General Public License 23 | along with bliss. If not, see . 24 | */ 25 | 26 | namespace bliss_digraphs { 27 | 28 | Heap::~Heap() 29 | { 30 | } 31 | 32 | void Heap::upheap(unsigned int index) 33 | { 34 | const unsigned int v = array[index]; 35 | array[0] = 0; 36 | while(array[index/2] > v) 37 | { 38 | array[index] = array[index/2]; 39 | index = index/2; 40 | } 41 | array[index] = v; 42 | } 43 | 44 | void Heap::downheap(unsigned int index) 45 | { 46 | const unsigned int v = array[index]; 47 | const unsigned int lim = n/2; 48 | while(index <= lim) 49 | { 50 | unsigned int new_index = index + index; 51 | if((new_index < n) and (array[new_index] > array[new_index+1])) 52 | new_index++; 53 | if(v <= array[new_index]) 54 | break; 55 | array[index] = array[new_index]; 56 | index = new_index; 57 | } 58 | array[index] = v; 59 | } 60 | 61 | void Heap::init(const unsigned int size) 62 | { 63 | if(size > N) 64 | { 65 | array_vec.resize(size + 1); 66 | array = array_vec.begin(); 67 | N = size; 68 | } 69 | n = 0; 70 | } 71 | 72 | void Heap::insert(const unsigned int v) 73 | { 74 | array[++n] = v; 75 | upheap(n); 76 | } 77 | 78 | unsigned int Heap::remove() 79 | { 80 | const unsigned int v = array[1]; 81 | array[1] = array[n--]; 82 | downheap(1); 83 | return v; 84 | } 85 | 86 | } // namespace bliss_digraphs 87 | -------------------------------------------------------------------------------- /extern/bliss-0.73/uintseqhash.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_UINTSEQHASH_HH 2 | #define BLISS_UINTSEQHASH_HH 3 | 4 | #include 5 | 6 | /* 7 | Copyright (c) 2003-2015 Tommi Junttila 8 | Released under the GNU Lesser General Public License version 3. 9 | 10 | This file is part of bliss. 11 | 12 | bliss is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU Lesser General Public License as published by 14 | the Free Software Foundation, version 3 of the License. 15 | 16 | bliss is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU Lesser General Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public License 22 | along with bliss. If not, see . 23 | */ 24 | 25 | namespace bliss_digraphs { 26 | 27 | /** \internal 28 | * \brief A hash for sequences of unsigned ints. 29 | */ 30 | class UintSeqHash 31 | { 32 | protected: 33 | unsigned int h; 34 | public: 35 | UintSeqHash() {h = 0; } 36 | UintSeqHash(const UintSeqHash &other) {h = other.h; } 37 | UintSeqHash& operator=(const UintSeqHash &other) {h = other.h; return *this; } 38 | 39 | /** Reset the hash value. */ 40 | void reset() {h = 0; } 41 | 42 | /** Add the unsigned int \a n to the sequence. */ 43 | void update(unsigned int n); 44 | 45 | /** Get the hash value of the sequence seen so far. */ 46 | unsigned int get_value() const {return h; } 47 | 48 | /** Compare the hash values of this and \a other. 49 | * Return -1/0/1 if the value of this is smaller/equal/greater than 50 | * that of \a other. */ 51 | int cmp(const UintSeqHash &other) const { 52 | return (h < other.h)?-1:((h == other.h)?0:1); 53 | } 54 | /** An abbreviation for cmp(other) < 0 */ 55 | bool is_lt(const UintSeqHash &other) const {return(cmp(other) < 0); } 56 | /** An abbreviation for cmp(other) <= 0 */ 57 | bool is_le(const UintSeqHash &other) const {return(cmp(other) <= 0); } 58 | /** An abbreviation for cmp(other) == 0 */ 59 | bool is_equal(const UintSeqHash &other) const {return(cmp(other) == 0); } 60 | }; 61 | 62 | 63 | } // namespace bliss_digraphs 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /m4/ax_check_compile_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the current language's compiler 12 | # or gives an error. (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the current language's default 18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 20 | # force the compiler to issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # Copying and distribution of this file, with or without modification, are 33 | # permitted in any medium without royalty provided the copyright notice 34 | # and this notice are preserved. This file is offered as-is, without any 35 | # warranty. 36 | 37 | #serial 6 38 | 39 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], 40 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 41 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 42 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 43 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 44 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 45 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 46 | [AS_VAR_SET(CACHEVAR,[yes])], 47 | [AS_VAR_SET(CACHEVAR,[no])]) 48 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 49 | AS_VAR_IF(CACHEVAR,yes, 50 | [m4_default([$2], :)], 51 | [m4_default([$3], :)]) 52 | AS_VAR_POPDEF([CACHEVAR])dnl 53 | ])dnl AX_CHECK_COMPILE_FLAGS 54 | -------------------------------------------------------------------------------- /extern/bliss-0.73/utils.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_UTILS_HH 2 | #define BLISS_UTILS_HH 3 | 4 | /* 5 | Copyright (c) 2003-2015 Tommi Junttila 6 | Released under the GNU Lesser General Public License version 3. 7 | 8 | This file is part of bliss. 9 | 10 | bliss is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation, version 3 of the License. 13 | 14 | bliss is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with bliss. If not, see . 21 | */ 22 | 23 | /** 24 | * \file 25 | * \brief Some small utilities. 26 | * 27 | */ 28 | 29 | #include 30 | 31 | namespace bliss_digraphs { 32 | 33 | /** 34 | * Print the permutation \a perm of {0,...,N-1} in the cycle format 35 | * in the file stream \a fp. 36 | * The amount \a offset is added to each element before printing, 37 | * e.g. the permutation (2 4) is printed as (3 5) when \a offset is 1. 38 | */ 39 | void print_permutation(FILE* fp, 40 | const unsigned int N, 41 | const unsigned int* perm, 42 | const unsigned int offset = 0); 43 | 44 | /** 45 | * Print the permutation \a perm of {0,...,N-1} in the cycle format 46 | * in the file stream \a fp. 47 | * The amount \a offset is added to each element before printing, 48 | * e.g. the permutation (2 4) is printed as (3 5) when \a offset is 1. 49 | */ 50 | void print_permutation(FILE* fp, 51 | const std::vector& perm, 52 | const unsigned int offset = 0); 53 | 54 | /** 55 | * Check whether \a perm is a valid permutation on {0,...,N-1}. 56 | * Slow, mainly for debugging and validation purposes. 57 | */ 58 | bool is_permutation(const unsigned int N, const unsigned int* perm); 59 | 60 | /** 61 | * Check whether \a perm is a valid permutation on {0,...,N-1}. 62 | * Slow, mainly for debugging and validation purposes. 63 | */ 64 | bool is_permutation(const std::vector& perm); 65 | 66 | } // namespace bliss_digraphs 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /VERSIONS: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W VERSIONS 4 | #Y Copyright (C) 2015-25 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README.md file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | release 1.13.1 - 27/09/2025 12 | release 1.13.0 - 26/09/2025 13 | release 1.12.2 - 20/09/2025 14 | release 1.12.1 - 10/09/2025 15 | release 1.12.0 - 02/09/2025 16 | release 1.11.0 - 28/08/2025 17 | release 1.10.1 - 27/08/2025 18 | release 1.10.0 - 14/02/2025 19 | release 1.9.0 - 06/09/2024 20 | release 1.8.0 - 27/08/2024 21 | release 1.7.1 - 19/02/2024 22 | release 1.7.0 - 14/02/2024 23 | release 1.6.3 - 13/09/2023 24 | release 1.6.2 - 05/04/2023 25 | release 1.6.1 - 06/12/2022 26 | release 1.6.0 - 08/09/2022 27 | release 1.5.3 - 20/05/2022 28 | release 1.5.2 - 30/03/2022 29 | release 1.5.1 - 29/03/2022 30 | release 1.5.0 - 27/10/2021 31 | release 1.4.1 - 14/05/2021 32 | release 1.4.0 - 27/01/2021 33 | release 1.3.1 - 27/11/2020 34 | release 1.3.0 - 27/06/2020 35 | release 1.2.1 - 27/05/2020 36 | release 1.2.0 - 27/03/2020 37 | release 1.1.2 - 16/03/2020 38 | release 1.1.1 - 29/01/2020 39 | release 1.1.0 - 25/01/2020 40 | release 1.0.3 - 29/11/2019 41 | release 1.0.2 - 28/11/2019 42 | release 1.0.1 - 05/10/2019 43 | release 1.0.0 - 03/10/2019 44 | release 0.15.4 - 06/08/2019 45 | release 0.15.3 - 12/06/2019 46 | release 0.15.2 - 17/04/2019 47 | release 0.15.1 - 26/03/2019 48 | release 0.15.0 - 15/02/2019 49 | release 0.14.0 - 23/11/2018 50 | release 0.13.0 - 19/09/2018 51 | release 0.12.2 - 24/08/2018 52 | release 0.12.1 - 26/04/2018 53 | release 0.12.0 - 31/01/2018 54 | release 0.11.0 - 22/11/2017 55 | release 0.10.1 - 16/08/2017 56 | release 0.10.0 - 20/07/2017 57 | release 0.9.0 - 12/07/2017 58 | release 0.8.1 - 18/05/2017 59 | release 0.8.0 - 17/05/2017 60 | release 0.7.1 - 22/03/2017 61 | release 0.7.0 - 14/03/2017 62 | release 0.6.1 - 01/03/2017 63 | release 0.6.0 - 09/12/2016 64 | release 0.5.2 - 20/06/2016 65 | release 0.5.1 - 08/06/2016 66 | release 0.5.0 - 03/03/2016 67 | release 0.4.2 - 28/01/2016 68 | release 0.4.1 - 22/01/2016 69 | release 0.4.0 - 19/01/2016 70 | release 0.3.2 - 14/01/2016 71 | release 0.3.1 - 13/01/2016 72 | release 0.3.0 - 12/01/2016 73 | release 0.2.0 - 04/09/2015 74 | -------------------------------------------------------------------------------- /.github/workflows/valgrind.yml: -------------------------------------------------------------------------------- 1 | name: Valgrind 2 | on: 3 | workflow_dispatch: 4 | release: 5 | types: [created] 6 | push: 7 | paths: 8 | - src/*.[hc] 9 | pull_request: 10 | paths: 11 | - src/*.[hc] 12 | - .VERSION 13 | 14 | env: 15 | VALGRIND: valgrind --trace-children=yes --leak-check=full --error-exitcode=1 16 | NO_COVERAGE: true 17 | 18 | concurrency: 19 | # Group by workflow and ref; the last component ensures that for pull requests 20 | # we limit to one concurrent job, but for the main/stable branches we don't 21 | group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/stable-')) || github.run_number }} 22 | # Only cancel intermediate pull request builds 23 | cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} 24 | 25 | jobs: 26 | test-valgrind: 27 | name: Ubuntu / GAP stable-4.15 / valgrind 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v5 31 | - name: "Output g++ version . . ." 32 | run: g++ --version 33 | - name: "Install Valgrind . . ." 34 | run: sudo apt-get install valgrind 35 | - name: "Install GAP . . ." 36 | uses: gap-actions/setup-gap@v3 37 | with: 38 | gap-version: stable-4.15 39 | configflags: --enable-valgrind 40 | - name: "Install necessary GAP package clones . . ." 41 | run: | 42 | for PKG in https://github.com/digraphs/graphviz.git https://github.com/gap-packages/NautyTracesInterface.git; do 43 | cd ${GAPROOT}/pkg 44 | git clone $PKG 45 | done 46 | - name: "Build additional necessary GAP packages . . ." 47 | run: | 48 | cd ${GAPROOT}/pkg 49 | ../bin/BuildPackages.sh --strict io orb datastructures grape NautyTracesInterface 50 | - name: "Build Digraphs . . ." 51 | uses: gap-actions/build-pkg@v2 52 | - name: "Run DigraphsTestInstall . . ." 53 | uses: gap-actions/run-pkg-tests@v4 54 | with: 55 | coverage: false 56 | testfile: tst/github_actions/install.g 57 | pre-gap: ${{ env.VALGRIND }} 58 | - name: "Run DigraphsTestStandard . . ." 59 | uses: gap-actions/run-pkg-tests@v4 60 | with: 61 | coverage: false 62 | testfile: tst/github_actions/standard.g 63 | pre-gap: ${{ env.VALGRIND }} 64 | -------------------------------------------------------------------------------- /extern/bliss-0.73/heap.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_HEAP_HH 2 | #define BLISS_HEAP_HH 3 | 4 | #include 5 | 6 | /* 7 | Copyright (c) 2003-2015 Tommi Junttila 8 | Released under the GNU Lesser General Public License version 3. 9 | 10 | This file is part of bliss. 11 | 12 | bliss is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU Lesser General Public License as published by 14 | the Free Software Foundation, version 3 of the License. 15 | 16 | bliss is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU Lesser General Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public License 22 | along with bliss. If not, see . 23 | */ 24 | 25 | namespace bliss_digraphs { 26 | 27 | /** \internal 28 | * \brief A capacity bounded heap data structure. 29 | */ 30 | 31 | class Heap 32 | { 33 | unsigned int N; 34 | unsigned int n; 35 | std::vector array_vec; 36 | 37 | typedef std::vector::iterator uint_pointer_substitute; 38 | uint_pointer_substitute array; 39 | void upheap(unsigned int k); 40 | void downheap(unsigned int k); 41 | public: 42 | /** 43 | * Create a new heap. 44 | * init() must be called after this. 45 | */ 46 | Heap() { n = 0; N = 0; } 47 | ~Heap(); 48 | 49 | /** 50 | * Initialize the heap to have the capacity to hold \e size elements. 51 | */ 52 | void init(const unsigned int size); 53 | 54 | /** 55 | * Is the heap empty? 56 | * Time complexity is O(1). 57 | */ 58 | bool is_empty() const {return(n==0); } 59 | 60 | /** 61 | * Remove all the elements in the heap. 62 | * Time complexity is O(1). 63 | */ 64 | void clear() {n = 0;} 65 | 66 | /** 67 | * Insert the element \a e in the heap. 68 | * Time complexity is O(log(N)), where N is the number of elements 69 | * currently in the heap. 70 | */ 71 | void insert(const unsigned int e); 72 | 73 | /** 74 | * Remove and return the smallest element in the heap. 75 | * Time complexity is O(log(N)), where N is the number of elements 76 | * currently in the heap. 77 | */ 78 | unsigned int remove(); 79 | 80 | /** 81 | * Get the number of elements in the heap. 82 | */ 83 | unsigned int size() const {return n; } 84 | }; 85 | 86 | } // namespace bliss_digraphs 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/extensionSystem/graphFunctionTable.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHFUNCTIONTABLE_H 2 | #define GRAPHFUNCTIONTABLE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | /* 16 | NOTE: If you add any FUNCTION POINTERS to this function table, then you must 17 | also initialize them in _InitFunctionTable() in graphUtils.c. 18 | */ 19 | typedef struct baseGraphStructure baseGraphStructure; 20 | typedef baseGraphStructure *graphP; 21 | 22 | typedef struct 23 | { 24 | // These function pointers allow extension modules to overload some of 25 | // the behaviors of protected functions. Only advanced applications 26 | // will overload these functions 27 | int (*fpEmbeddingInitialize)(graphP); 28 | void (*fpEmbedBackEdgeToDescendant)(graphP, int, int, int, int); 29 | void (*fpWalkUp)(graphP, int, int); 30 | int (*fpWalkDown)(graphP, int, int); 31 | int (*fpMergeBicomps)(graphP, int, int, int, int); 32 | void (*fpMergeVertex)(graphP, int, int, int); 33 | int (*fpHandleInactiveVertex)(graphP, int, int *, int *); 34 | int (*fpHandleBlockedBicomp)(graphP, int, int, int); 35 | int (*fpEmbedPostprocess)(graphP, int, int); 36 | int (*fpMarkDFSPath)(graphP, int, int); 37 | 38 | int (*fpCheckEmbeddingIntegrity)(graphP, graphP); 39 | int (*fpCheckObstructionIntegrity)(graphP, graphP); 40 | 41 | // These function pointers allow extension modules to overload some 42 | // of the behaviors of gp_* function in the public API 43 | int (*fpInitGraph)(graphP, int); 44 | void (*fpReinitializeGraph)(graphP); 45 | int (*fpEnsureArcCapacity)(graphP, int); 46 | int (*fpSortVertices)(graphP); 47 | 48 | int (*fpReadPostprocess)(graphP, char *); 49 | int (*fpWritePostprocess)(graphP, char **); 50 | 51 | void (*fpHideEdge)(graphP, int); 52 | void (*fpRestoreEdge)(graphP, int); 53 | int (*fpHideVertex)(graphP, int); 54 | int (*fpRestoreVertex)(graphP); 55 | int (*fpContractEdge)(graphP, int); 56 | int (*fpIdentifyVertices)(graphP, int, int, int); 57 | 58 | } graphFunctionTable; 59 | 60 | typedef graphFunctionTable *graphFunctionTableP; 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /gap/weights.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## weights.gd 4 | ## Copyright (C) 2023 Raiyan Chowdhury 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | # 1. Edge Weights 12 | DeclareAttribute("EdgeWeights", IsDigraph); 13 | DeclareGlobalFunction("EdgeWeightedDigraph"); 14 | DeclareProperty("IsNegativeEdgeWeightedDigraph", IsDigraph and HasEdgeWeights); 15 | DeclareAttribute("EdgeWeightedDigraphTotalWeight", 16 | IsDigraph and HasEdgeWeights); 17 | 18 | # 2. Edge Weight Copies 19 | DeclareOperation("EdgeWeightsMutableCopy", [IsDigraph and HasEdgeWeights]); 20 | 21 | # 3. Minimum Spanning Trees 22 | DeclareAttribute("EdgeWeightedDigraphMinimumSpanningTree", 23 | IsDigraph and HasEdgeWeights); 24 | 25 | # 4. Shortest Path 26 | DeclareAttribute("EdgeWeightedDigraphShortestPaths", 27 | IsDigraph and HasEdgeWeights); 28 | DeclareOperation("EdgeWeightedDigraphShortestPaths", 29 | [IsDigraph and HasEdgeWeights, IsPosInt]); 30 | DeclareOperation("EdgeWeightedDigraphShortestPath", 31 | [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]); 32 | 33 | DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Johnson"); 34 | DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_FloydWarshall"); 35 | DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Bellman_Ford"); 36 | DeclareGlobalFunction("DIGRAPHS_Edge_Weighted_Dijkstra"); 37 | 38 | # 5. Maximum Flow and Minimum Cut 39 | DeclareOperation("DigraphMaximumFlow", 40 | [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]); 41 | DeclareOperation("DigraphMinimumCut", 42 | [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]); 43 | DeclareOperation("DigraphMinimumCutSet", 44 | [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]); 45 | 46 | # 6. Random edge weighted digraphs 47 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt]); 48 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsFloat]); 49 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsRat]); 50 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsFunction, IsPosInt]); 51 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", 52 | [IsFunction, IsPosInt, IsFloat]); 53 | DeclareOperation("RandomUniqueEdgeWeightedDigraph", 54 | [IsFunction, IsPosInt, IsRat]); 55 | -------------------------------------------------------------------------------- /init.g: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## init.g 4 | ## Copyright (C) 2014 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | # load a method for UserHomeExpand if necessary 12 | if not IsBound(UserHomeExpand) then 13 | BindGlobal("UserHomeExpand", USER_HOME_EXPAND); 14 | fi; 15 | 16 | if CompareVersionNumbers(GAPInfo.Version, "4.12") then 17 | if not LoadKernelExtension("digraphs") then 18 | Error("failed to load the Digraphs package kernel extension"); 19 | fi; 20 | else 21 | # TODO this clause can be removed once Digraphs requires GAP>=4.12.1 22 | # load kernel function if it is installed: 23 | if not IsBound(DIGRAPH_OUT_NBS) and "digraphs" in SHOW_STAT() then 24 | # try static module 25 | LoadStaticModule("digraphs"); 26 | fi; 27 | if not IsBound(DIGRAPH_OUT_NBS) and 28 | Filename(DirectoriesPackagePrograms("digraphs"), 29 | "digraphs.so") <> fail then 30 | LoadDynamicModule(Filename(DirectoriesPackagePrograms("digraphs"), 31 | "digraphs.so")); 32 | fi; 33 | fi; 34 | 35 | BindGlobal("DIGRAPHS_IsGrapeLoaded", 36 | {} -> IsPackageMarkedForLoading("grape", "4.8.1")); 37 | 38 | # To avoid warnings when GRAPE is not loaded 39 | if not IsBound(IsGraph) then 40 | IsGraph := ReturnFalse; 41 | fi; 42 | if not IsBound(Vertices) then 43 | DeclareOperation("Vertices", [IsRecord]); 44 | fi; 45 | if not IsBound(Adjacency) then 46 | Adjacency := IdFunc; 47 | fi; 48 | 49 | ReadPackage("digraphs", "gap/digraph.gd"); 50 | ReadPackage("digraphs", "gap/digraphs.g"); 51 | ReadPackage("digraphs", "gap/constructors.gd"); 52 | ReadPackage("digraphs", "gap/grape.gd"); 53 | ReadPackage("digraphs", "gap/labels.gd"); 54 | ReadPackage("digraphs", "gap/attr.gd"); 55 | ReadPackage("digraphs", "gap/prop.gd"); 56 | ReadPackage("digraphs", "gap/oper.gd"); 57 | ReadPackage("digraphs", "gap/display.gd"); 58 | ReadPackage("digraphs", "gap/isomorph.gd"); 59 | ReadPackage("digraphs", "gap/utils.gd"); 60 | ReadPackage("digraphs", "gap/io.gd"); 61 | ReadPackage("digraphs", "gap/grahom.gd"); 62 | ReadPackage("digraphs", "gap/orbits.gd"); 63 | ReadPackage("digraphs", "gap/cliques.gd"); 64 | ReadPackage("digraphs", "gap/planar.gd"); 65 | ReadPackage("digraphs", "gap/examples.gd"); 66 | ReadPackage("digraphs", "gap/weights.gd"); 67 | 68 | DeclareInfoClass("InfoDigraphs"); 69 | -------------------------------------------------------------------------------- /src/perms.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A perms.c GAP package Digraphs Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-15 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #include "perms.h" 16 | 17 | // Digraphs package headers 18 | #include "digraphs-debug.h" // for DIGRAPHS_ASSERT 19 | #include "gap-includes.h" // for ErrorQuit, ADDR_PERM2, .. 20 | #include "safemalloc.h" // for safe_malloc 21 | 22 | Perm new_perm(uint16_t const degree) { 23 | DIGRAPHS_ASSERT(degree <= MAXVERTS); 24 | return safe_malloc(degree * sizeof(uint16_t)); 25 | } 26 | 27 | Perm new_perm_from_gap(Obj gap_perm_obj, uint16_t const degree) { 28 | Perm p = new_perm(degree > 0 ? degree : 1); 29 | 30 | size_t copy_up_to = degree; 31 | size_t lmp = LargestMovedPointPerm(gap_perm_obj); 32 | if (degree > lmp) { 33 | copy_up_to = lmp; 34 | } 35 | 36 | if (IS_PERM2(gap_perm_obj)) { 37 | UInt2* gap_perm_ptr = ADDR_PERM2(gap_perm_obj); 38 | for (UInt i = 0; i < copy_up_to; ++i) { 39 | p[i] = gap_perm_ptr[i]; 40 | } 41 | for (UInt i = copy_up_to; i < degree; ++i) { 42 | p[i] = i; 43 | } 44 | } else { 45 | DIGRAPHS_ASSERT(IS_PERM4(gap_perm_obj)); 46 | UInt4* gap_perm_ptr = ADDR_PERM4(gap_perm_obj); 47 | for (UInt i = 0; i < copy_up_to; ++i) { 48 | p[i] = gap_perm_ptr[i]; 49 | } 50 | for (UInt i = copy_up_to; i < degree; ++i) { 51 | p[i] = i; 52 | } 53 | } 54 | return p; 55 | } 56 | 57 | PermColl* new_perm_coll(uint16_t const capacity, uint16_t const degree) { 58 | PermColl* coll = safe_malloc(sizeof(PermColl)); 59 | coll->perms = safe_malloc(capacity * sizeof(Perm)); 60 | for (uint16_t i = 0; i < capacity; ++i) { 61 | coll->perms[i] = new_perm(degree); 62 | } 63 | coll->size = 0; 64 | coll->degree = degree; 65 | coll->capacity = capacity; 66 | return coll; 67 | } 68 | 69 | void free_perm_coll(PermColl* coll) { 70 | for (uint16_t i = 0; i < coll->capacity; i++) { 71 | free(coll->perms[i]); 72 | } 73 | free(coll->perms); 74 | free(coll); 75 | } 76 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The Edge Addition Planarity Suite 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. Includes a reference implementation of the following: 4 | 5 | * John M. Boyer. "Subgraph Homeomorphism via the Edge Addition Planarity Algorithm". 6 | Journal of Graph Algorithms and Applications, Vol. 16, no. 2, pp. 381-410, 2012. 7 | http://dx.doi.org/10.7155/jgaa.00268 8 | 9 | * John M. Boyer. "A New Method for Efficiently Generating Planar Graph 10 | Visibility Representations". In P. Eades and P. Healy, editors, 11 | Proceedings of the 13th International Conference on Graph Drawing 2005, 12 | Lecture Notes Comput. Sci., Volume 3843, pp. 508-511, Springer-Verlag, 2006. 13 | http://dx.doi.org/10.1007/11618058_47 14 | 15 | * John M. Boyer and Wendy J. Myrvold. "On the Cutting Edge: Simplified O(n) 16 | Planarity by Edge Addition". Journal of Graph Algorithms and Applications, 17 | Vol. 8, No. 3, pp. 241-273, 2004. 18 | http://dx.doi.org/10.7155/jgaa.00091 19 | 20 | * John M. Boyer. "Simplified O(n) Algorithms for Planar Graph Embedding, 21 | Kuratowski Subgraph Isolation, and Related Problems". Ph.D. Dissertation, 22 | University of Victoria, 2001. 23 | https://dspace.library.uvic.ca/handle/1828/9918 24 | 25 | Redistribution and use in source and binary forms, with or without 26 | modification, are permitted provided that the following conditions are met: 27 | 28 | * Redistributions of source code must retain the above copyright notice, this 29 | list of conditions and the following disclaimer. 30 | 31 | * Redistributions in binary form must reproduce the above copyright notice, 32 | this list of conditions and the following disclaimer in the documentation 33 | and/or other materials provided with the distribution. 34 | 35 | * Neither the name of The Edge Addition Planarity Suite nor the names of its 36 | contributors may be used to endorse or promote products derived from 37 | this software without specific prior written permission. 38 | 39 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 40 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 42 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 43 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 44 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 45 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 46 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 47 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 48 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/lowLevelUtils/appconst.h: -------------------------------------------------------------------------------- 1 | #ifndef APPCONST_H 2 | #define APPCONST_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "apiutils.h" 11 | 12 | // NOTE: This is defined on 32- and 64-bit Windows systems; see 13 | // https://sourceforge.net/p/predef/wiki/OperatingSystems 14 | #if defined(WIN32) || defined(_WIN32) 15 | #define WINDOWS 16 | #endif 17 | 18 | /* Defines fopen strings for reading and writing text files on PC and UNIX */ 19 | 20 | #ifdef WINDOWS 21 | #define READTEXT "rt" 22 | #define WRITETEXT "wt" 23 | #define FILE_DELIMITER '\\' 24 | #else 25 | #define READTEXT "r" 26 | #define WRITETEXT "w" 27 | #define FILE_DELIMITER '/' 28 | #endif 29 | 30 | // When PROFILE is defined, prints out run-time stats on a number of subordinate 31 | // routines in the embedder 32 | 33 | // #define PROFILE 34 | #ifdef PROFILE 35 | #include "platformTime.h" 36 | #endif 37 | 38 | /* Define DEBUG to get additional debugging. The default is to define it when MSC does */ 39 | 40 | #ifdef _DEBUG 41 | #define DEBUG 42 | #endif 43 | 44 | /* Some low-level functions are replaced by faster macros, except when debugging */ 45 | 46 | #define SPEED_MACROS 47 | #ifdef DEBUG 48 | #undef SPEED_MACROS 49 | #endif 50 | 51 | /* Return status values; OK/NOTOK behave like Boolean true/false, 52 | not like program exit codes. */ 53 | 54 | #define OK 1 55 | #define NOTOK 0 56 | 57 | #ifdef DEBUG 58 | #undef NOTOK 59 | extern int debugNOTOK(void); 60 | #include 61 | #define NOTOK (printf("NOTOK on Line %d of %s\n", __LINE__, __FILE__), debugNOTOK()) 62 | #endif 63 | 64 | #ifndef TRUE 65 | #define TRUE 1 66 | #endif 67 | 68 | #ifndef FALSE 69 | #define FALSE 0 70 | #endif 71 | 72 | #ifndef NULL 73 | #define NULL 0L 74 | #endif 75 | 76 | /* Array indices are used as pointers, and NIL means bad pointer */ 77 | #define USE_FASTER_1BASEDARRAYS 78 | 79 | #ifdef USE_0BASEDARRAYS 80 | #undef USE_FASTER_1BASEDARRAYS 81 | #endif 82 | 83 | #ifdef USE_FASTER_1BASEDARRAYS 84 | // This definition is used with 1-based array indexing 85 | #define NIL 0 86 | #define NIL_CHAR 0x00 87 | #else 88 | // This definition is used with 0-based array indexing 89 | #define NIL -1 90 | #define NIL_CHAR 0xFF 91 | #endif 92 | 93 | /******************************************************************** 94 | A few simple integer selection macros 95 | ********************************************************************/ 96 | 97 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) 98 | #define MAX(x, y) ((x) > (y) ? (x) : (y)) 99 | 100 | #define MIN3(x, y, z) MIN(MIN((x), (y)), MIN((y), (z))) 101 | #define MAX3(x, y, z) MAX(MAX((x), (y)), MAX((y), (z))) 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/planarityApp/planarity.h: -------------------------------------------------------------------------------- 1 | #ifndef PLANARITY_H 2 | #define PLANARITY_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | #include "../graphLib/graphLib.h" 16 | 17 | char *GetProjectTitle(void); 18 | char *GetAlgorithmFlags(void); 19 | char *GetAlgorithmSpecifiers(void); 20 | char *GetAlgorithmChoices(void); 21 | char *GetSupportedOutputChoices(void); 22 | char *GetSupportedOutputFormats(void); 23 | 24 | int helpMessage(char *param); 25 | 26 | /* Functions that call the Graph Library */ 27 | int SpecificGraph( 28 | char command, 29 | char *infileName, char *outfileName, char *outfile2Name, 30 | char *inputStr, char **pOutputStr, char **pOutput2Str); 31 | int RandomGraph(char command, int extraEdges, int numVertices, char *outfileName, char *outfile2Name); 32 | int RandomGraphs(char command, int NumGraphs, int SizeOfGraphs, char *outfileName); 33 | int TransformGraph(char *commandString, char *infileName, char *inputStr, int *outputBase, char *outfileName, char **outputStr); 34 | int TestAllGraphs(char *commandString, char *infileName, char *outfileName, char **outputStr); 35 | 36 | /* Command line, Menu, and Configuration */ 37 | int menu(void); 38 | int commandLine(int argc, char *argv[]); 39 | int legacyCommandLine(int argc, char *argv[]); 40 | 41 | extern char Mode, 42 | OrigOut, 43 | OrigOutFormat, 44 | EmbeddableOut, 45 | ObstructedOut, 46 | AdjListsForEmbeddingsOut; 47 | 48 | void Reconfigure(void); 49 | 50 | /* Low-level Utilities */ 51 | void FlushConsole(FILE *f); 52 | void Prompt(char *message); 53 | 54 | void SaveAsciiGraph(graphP theGraph, char *filename); 55 | 56 | char *ReadTextFileIntoString(char *infileName); 57 | int TextFileMatchesString(char *theFilename, char *theString); 58 | int TextFilesEqual(char *file1Name, char *file2Name); 59 | int BinaryFilesEqual(char *file1Name, char *file2Name); 60 | 61 | int GetEmbedFlags(char command); 62 | char *GetAlgorithmName(char command); 63 | char *GetTransformationName(char command); 64 | char *GetBaseName(int baseFlag); 65 | void AttachAlgorithm(graphP theGraph, char command); 66 | 67 | char *ConstructInputFilename(char *infileName); 68 | char *ConstructPrimaryOutputFilename(char *infileName, char *outfileName, char command); 69 | int ConstructTransformationExpectedResultFilename(char *infileName, char **outfileName, char command, int actualOrExpectedFlag); 70 | void WriteAlgorithmResults(graphP theGraph, int Result, char command, platform_time start, platform_time end, char *infileName); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /gap/io.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## io.gd 4 | ## Copyright (C) 2014-16 James D. Mitchell 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | # TODO Document the optional (e.g.) `IsMutableDigraph` first argument for 12 | # many of these operations. 13 | 14 | # Read/WriteDigraphs (the main functions) . . . 15 | DeclareGlobalFunction("ReadDigraphs"); 16 | DeclareGlobalFunction("WriteDigraphs"); 17 | 18 | DeclareGlobalFunction("DigraphFile"); 19 | DeclareGlobalFunction("IteratorFromDigraphFile"); 20 | DeclareGlobalFunction("IsWholeFileDecoder"); 21 | DeclareGlobalFunction("IsWholeFileEncoder"); 22 | 23 | # Decoders . . . 24 | DeclareConstructor("DigraphFromGraph6StringCons", [IsDigraph, IsString]); 25 | DeclareOperation("DigraphFromGraph6String", [IsFunction, IsString]); 26 | DeclareOperation("DigraphFromGraph6String", [IsString]); 27 | DeclareConstructor("DigraphFromDigraph6StringCons", [IsDigraph, IsString]); 28 | DeclareOperation("DigraphFromDigraph6String", [IsFunction, IsString]); 29 | DeclareOperation("DigraphFromDigraph6String", [IsString]); 30 | DeclareConstructor("DigraphFromSparse6StringCons", [IsDigraph, IsString]); 31 | DeclareOperation("DigraphFromSparse6String", [IsFunction, IsString]); 32 | DeclareOperation("DigraphFromSparse6String", [IsString]); 33 | DeclareConstructor("DigraphFromDiSparse6StringCons", [IsDigraph, IsString]); 34 | DeclareOperation("DigraphFromDiSparse6String", [IsFunction, IsString]); 35 | DeclareOperation("DigraphFromDiSparse6String", [IsString]); 36 | DeclareConstructor("DigraphFromPlainTextStringCons", [IsDigraph, IsString]); 37 | DeclareOperation("DigraphFromPlainTextString", [IsFunction, IsString]); 38 | DeclareOperation("DigraphFromPlainTextString", [IsString]); 39 | DeclareOperation("ReadDIMACSDigraph", [IsString]); 40 | DeclareOperation("DigraphFromDIMACSString", [IsString]); 41 | DeclareOperation("TournamentLineDecoder", [IsString]); 42 | DeclareOperation("DigraphFromDreadnautString", [IsString]); 43 | 44 | DeclareOperation("DigraphPlainTextLineDecoder", 45 | [IsString, IsString, IsInt]); 46 | DeclareOperation("ReadPlainTextDigraph", 47 | [IsString, IsString, IsInt, IsString]); 48 | DeclareOperation("AdjacencyMatrixUpperTriangleLineDecoder", 49 | [IsString]); 50 | 51 | DeclareOperation("TCodeDecoder", [IsString]); 52 | DeclareGlobalFunction("TCodeDecoderNC"); 53 | 54 | # Encoders . . . 55 | DeclareOperation("Graph6String", [IsDigraph]); 56 | DeclareOperation("Digraph6String", [IsDigraph]); 57 | DeclareOperation("Sparse6String", [IsDigraph]); 58 | DeclareOperation("DiSparse6String", [IsDigraph]); 59 | DeclareOperation("PlainTextString", [IsDigraph]); 60 | DeclareOperation("WriteDIMACSDigraph", [IsString, IsDigraph]); 61 | DeclareOperation("DIMACSString", [IsDigraph]); 62 | DeclareGlobalFunction("WritePlainTextDigraph"); 63 | DeclareGlobalFunction("DreadnautString"); 64 | DeclareGlobalFunction("DigraphPlainTextLineEncoder"); 65 | -------------------------------------------------------------------------------- /src/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | # BasedOnStyle: LLVM 4 | AccessModifierOffset: -1 5 | AlignAfterOpenBracket: Align 6 | AlignConsecutiveAssignments: true 7 | AlignConsecutiveDeclarations: true 8 | AlignEscapedNewlinesLeft: true 9 | AlignOperands: true 10 | AlignTrailingComments: true 11 | AllowAllParametersOfDeclarationOnNextLine: false 12 | AllowShortBlocksOnASingleLine: false 13 | AllowShortCaseLabelsOnASingleLine: false 14 | AllowShortFunctionsOnASingleLine: Empty 15 | AllowShortIfStatementsOnASingleLine: false 16 | AllowShortLoopsOnASingleLine: false 17 | AlwaysBreakAfterDefinitionReturnType: None 18 | AlwaysBreakAfterReturnType: None 19 | AlwaysBreakBeforeMultilineStrings: false 20 | AlwaysBreakTemplateDeclarations: false 21 | BinPackArguments: false 22 | BinPackParameters: false 23 | BraceWrapping: 24 | AfterClass: false 25 | AfterControlStatement: false 26 | AfterEnum: false 27 | AfterFunction: false 28 | AfterNamespace: false 29 | AfterObjCDeclaration: false 30 | AfterStruct: false 31 | AfterUnion: false 32 | BeforeCatch: false 33 | BeforeElse: false 34 | IndentBraces: false 35 | BreakBeforeBinaryOperators: NonAssignment 36 | BreakBeforeBraces: Attach 37 | BreakBeforeTernaryOperators: true 38 | BreakConstructorInitializersBeforeComma: false 39 | BreakAfterJavaFieldAnnotations: false 40 | BreakStringLiterals: true 41 | ColumnLimit: 80 42 | CommentPragmas: '^ IWYU pragma:' 43 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 44 | ConstructorInitializerIndentWidth: 4 45 | ContinuationIndentWidth: 4 46 | Cpp11BracedListStyle: true 47 | DerivePointerAlignment: false 48 | DisableFormat: false 49 | ExperimentalAutoDetectBinPacking: false 50 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] 51 | IncludeCategories: 52 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/' 53 | Priority: 2 54 | - Regex: '^(<|"(gtest|isl|json)/)' 55 | Priority: 3 56 | - Regex: '.*' 57 | Priority: 1 58 | IncludeIsMainRegex: '$' 59 | IndentCaseLabels: true 60 | IndentWidth: 2 61 | IndentWrappedFunctionNames: false 62 | JavaScriptQuotes: Leave 63 | JavaScriptWrapImports: true 64 | KeepEmptyLinesAtTheStartOfBlocks: true 65 | MacroBlockBegin: '' 66 | MacroBlockEnd: '' 67 | MaxEmptyLinesToKeep: 1 68 | NamespaceIndentation: All 69 | ObjCBlockIndentWidth: 2 70 | ObjCSpaceAfterProperty: false 71 | ObjCSpaceBeforeProtocolList: true 72 | PenaltyBreakBeforeFirstCallParameter: 19 73 | PenaltyBreakComment: 300 74 | PenaltyBreakFirstLessLess: 120 75 | PenaltyBreakString: 1000 76 | PenaltyExcessCharacter: 1000000 77 | PenaltyReturnTypeOnItsOwnLine: 60 78 | PointerAlignment: Left 79 | ReflowComments: true 80 | SortIncludes: true 81 | SpaceAfterCStyleCast: true 82 | SpaceBeforeAssignmentOperators: true 83 | SpaceBeforeParens: ControlStatements 84 | SpaceInEmptyParentheses: false 85 | SpacesBeforeTrailingComments: 2 86 | SpacesInAngles: false 87 | SpacesInContainerLiterals: true 88 | SpacesInCStyleCastParentheses: false 89 | SpacesInParentheses: false 90 | SpacesInSquareBrackets: false 91 | Standard: Cpp11 92 | TabWidth: 2 93 | UseTab: Never 94 | ... 95 | 96 | -------------------------------------------------------------------------------- /m4/find_gap.m4: -------------------------------------------------------------------------------- 1 | # Find the location of GAP 2 | # Sets GAPROOT, GAPARCH and GAP_CPPFLAGS appropriately 3 | # Can be configured using --with-gaproot=... 4 | ####################################################################### 5 | 6 | AC_DEFUN([FIND_GAP], 7 | [ 8 | AC_LANG_PUSH([C]) 9 | 10 | # Make sure CDPATH is portably set to a sensible value 11 | CDPATH=${ZSH_VERSION+.}: 12 | 13 | GAP_CPPFLAGS="" 14 | 15 | ###################################### 16 | # Find the GAP root directory by 17 | # checking for the sysinfo.gap file 18 | AC_MSG_CHECKING([for GAP root directory]) 19 | GAPROOT="../.." 20 | 21 | # Allow the user to specify the location of GAP 22 | AC_ARG_WITH(gaproot, 23 | [AS_HELP_STRING([--with-gaproot=], [specify root of GAP installation])], 24 | [GAPROOT="$withval"]) 25 | 26 | # Convert the path to absolute 27 | GAPROOT=`cd $GAPROOT > /dev/null 2>&1 && pwd` 28 | 29 | if test -e ${GAPROOT}/sysinfo.gap; then 30 | AC_MSG_RESULT([${GAPROOT}]) 31 | else 32 | AC_MSG_RESULT([Not found]) 33 | 34 | echo "" 35 | echo "********************************************************************" 36 | echo " ERROR" 37 | echo "" 38 | echo " Cannot find your GAP installation. Please specify the location of" 39 | echo " GAP's root directory using --with-gaproot=" 40 | echo "" 41 | echo " The GAP root directory (as far as this package is concerned) is" 42 | echo " the one containing the file sysinfo.gap" 43 | echo "********************************************************************" 44 | echo "" 45 | 46 | AC_MSG_ERROR([Unable to find GAP root directory]) 47 | fi 48 | 49 | ##################################### 50 | # Now find the architecture 51 | 52 | AC_MSG_CHECKING([for GAP architecture]) 53 | GAPARCH="Unknown" 54 | . $GAPROOT/sysinfo.gap 55 | if test "x$GAParch" != "x"; then 56 | GAPARCH=$GAParch 57 | fi 58 | 59 | if test "x$GAPARCH" = "xUnknown" ; then 60 | echo "" 61 | echo "********************************************************************" 62 | echo " ERROR" 63 | echo "" 64 | echo " Found a GAP installation at $GAPROOT but could not find" 65 | echo " information about GAP's architecture in the file" 66 | echo " ${GAPROOT}/sysinfo.gap ." 67 | echo " This file should be present: please check your GAP installation." 68 | echo "********************************************************************" 69 | echo "" 70 | 71 | AC_MSG_ERROR([Unable to find plausible GAParch information.]) 72 | fi 73 | 74 | # require GAP >= 4.9 75 | if test "x$GAP_CPPFLAGS" = x; then 76 | echo "" 77 | echo "********************************************************************" 78 | echo " ERROR" 79 | echo "" 80 | echo " This version of GAP is too old and not supported by this package." 81 | echo "********************************************************************" 82 | echo "" 83 | AC_MSG_ERROR([No GAP_CPPFLAGS is given]) 84 | fi 85 | 86 | AC_SUBST(GAPARCH) 87 | AC_SUBST(GAPROOT) 88 | AC_SUBST(GAP_CPPFLAGS) 89 | AC_SUBST(GAP_CFLAGS) 90 | AC_SUBST(GAP_LDFLAGS) 91 | AC_SUBST(GAP_LIBS) 92 | 93 | AC_LANG_POP([C]) 94 | ]) 95 | -------------------------------------------------------------------------------- /extern/bliss-0.73/utils.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "utils.hh" 4 | 5 | /* 6 | Copyright (c) 2003-2015 Tommi Junttila 7 | Released under the GNU Lesser General Public License version 3. 8 | 9 | This file is part of bliss. 10 | 11 | bliss is free software: you can redistribute it and/or modify 12 | it under the terms of the GNU Lesser General Public License as published by 13 | the Free Software Foundation, version 3 of the License. 14 | 15 | bliss is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with bliss. If not, see . 22 | */ 23 | 24 | namespace bliss_digraphs { 25 | 26 | void 27 | print_permutation(FILE* const fp, 28 | const unsigned int N, 29 | const unsigned int* perm, 30 | const unsigned int offset) 31 | { 32 | assert(N > 0); 33 | assert(perm); 34 | for(unsigned int i = 0; i < N; i++) { 35 | unsigned int j = perm[i]; 36 | if(j == i) 37 | continue; 38 | bool is_first = true; 39 | while(j != i) { 40 | if(j < i) { 41 | is_first = false; 42 | break; 43 | } 44 | j = perm[j]; 45 | } 46 | if(!is_first) 47 | continue; 48 | fprintf(fp, "(%u,", i+offset); 49 | j = perm[i]; 50 | while(j != i) { 51 | fprintf(fp, "%u", j+offset); 52 | j = perm[j]; 53 | if(j != i) 54 | fprintf(fp, ","); 55 | } 56 | fprintf(fp, ")"); 57 | } 58 | } 59 | 60 | void 61 | print_permutation(FILE* const fp, 62 | const std::vector& perm, 63 | const unsigned int offset) 64 | { 65 | const unsigned int N = perm.size(); 66 | for(unsigned int i = 0; i < N; i++) { 67 | unsigned int j = perm[i]; 68 | if(j == i) 69 | continue; 70 | bool is_first = true; 71 | while(j != i) { 72 | if(j < i) { 73 | is_first = false; 74 | break; 75 | } 76 | j = perm[j]; 77 | } 78 | if(!is_first) 79 | continue; 80 | fprintf(fp, "(%u,", i+offset); 81 | j = perm[i]; 82 | while(j != i) { 83 | fprintf(fp, "%u", j+offset); 84 | j = perm[j]; 85 | if(j != i) 86 | fprintf(fp, ","); 87 | } 88 | fprintf(fp, ")"); 89 | } 90 | } 91 | 92 | bool 93 | is_permutation(const unsigned int N, const unsigned int* perm) 94 | { 95 | if(N == 0) 96 | return true; 97 | std::vector m(N, false); 98 | for(unsigned int i = 0; i < N; i++) { 99 | if(perm[i] >= N) return false; 100 | if(m[perm[i]]) return false; 101 | m[perm[i]] = true; 102 | } 103 | return true; 104 | } 105 | 106 | bool 107 | is_permutation(const std::vector& perm) 108 | { 109 | const unsigned int N = perm.size(); 110 | if(N == 0) 111 | return true; 112 | std::vector m(N, false); 113 | for(unsigned int i = 0; i < N; i++) { 114 | if(perm[i] >= N) return false; 115 | if(m[perm[i]]) return false; 116 | m[perm[i]] = true; 117 | } 118 | return true; 119 | } 120 | 121 | 122 | } // namespace bliss_digraphs 123 | -------------------------------------------------------------------------------- /extern/bliss-0.73/orbit.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "defs.hh" 4 | #include "orbit.hh" 5 | 6 | /* 7 | Copyright (c) 2003-2015 Tommi Junttila 8 | Released under the GNU Lesser General Public License version 3. 9 | 10 | This file is part of bliss. 11 | 12 | bliss is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU Lesser General Public License as published by 14 | the Free Software Foundation, version 3 of the License. 15 | 16 | bliss is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU Lesser General Public License for more details. 20 | 21 | You should have received a copy of the GNU Lesser General Public License 22 | along with bliss. If not, see . 23 | */ 24 | 25 | namespace bliss_digraphs { 26 | 27 | Orbit::Orbit() 28 | { 29 | nof_elements = 0; 30 | } 31 | 32 | 33 | Orbit::~Orbit() 34 | { 35 | } 36 | 37 | 38 | void Orbit::init(const unsigned int n) 39 | { 40 | assert(n > 0); 41 | orbits_vec.resize(n); 42 | orbits = orbits_vec.begin(); 43 | in_orbit_vec.resize(n); 44 | in_orbit = in_orbit_vec.begin(); 45 | nof_elements = n; 46 | 47 | reset(); 48 | } 49 | 50 | 51 | void Orbit::reset() 52 | { 53 | assert(!orbits_vec.empty()); 54 | assert(!in_orbit_vec.empty()); 55 | 56 | for(unsigned int i = 0; i < nof_elements; i++) 57 | { 58 | orbits[i].element = i; 59 | orbits[i].next = 0; 60 | orbits[i].size = 1; 61 | in_orbit[i] = &orbits[i]; 62 | } 63 | _nof_orbits = nof_elements; 64 | } 65 | 66 | 67 | void Orbit::merge_orbits(OrbitEntry *orbit1, OrbitEntry *orbit2) 68 | { 69 | 70 | if(orbit1 != orbit2) 71 | { 72 | _nof_orbits--; 73 | /* Only update the elements in the smaller orbit */ 74 | if(orbit1->size > orbit2->size) 75 | { 76 | OrbitEntry * const temp = orbit2; 77 | orbit2 = orbit1; 78 | orbit1 = temp; 79 | } 80 | /* Link the elements of orbit1 to the almost beginning of orbit2 */ 81 | OrbitEntry *e = orbit1; 82 | while(e->next) 83 | { 84 | in_orbit[e->element] = orbit2; 85 | e = e->next; 86 | } 87 | in_orbit[e->element] = orbit2; 88 | e->next = orbit2->next; 89 | orbit2->next = orbit1; 90 | /* Keep the minimal orbit representative in the beginning */ 91 | if(orbit1->element < orbit2->element) 92 | { 93 | const unsigned int temp = orbit1->element; 94 | orbit1->element = orbit2->element; 95 | orbit2->element = temp; 96 | } 97 | orbit2->size += orbit1->size; 98 | } 99 | } 100 | 101 | 102 | void Orbit::merge_orbits(unsigned int e1, unsigned int e2) 103 | { 104 | 105 | merge_orbits(in_orbit[e1], in_orbit[e2]); 106 | } 107 | 108 | 109 | bool Orbit::is_minimal_representative(unsigned int element) const 110 | { 111 | return(get_minimal_representative(element) == element); 112 | } 113 | 114 | 115 | unsigned int Orbit::get_minimal_representative(unsigned int element) const 116 | { 117 | 118 | OrbitEntry * const orbit = in_orbit[element]; 119 | 120 | return(orbit->element); 121 | } 122 | 123 | 124 | unsigned int Orbit::orbit_size(unsigned int element) const 125 | { 126 | 127 | return(in_orbit[element]->size); 128 | } 129 | 130 | 131 | } // namespace bliss_digraphs 132 | -------------------------------------------------------------------------------- /doc/z-chap5.xml: -------------------------------------------------------------------------------- 1 | Properties of digraphs 2 | 3 |
Vertex properties 4 | <#Include Label="DigraphHasAVertex"> 5 | <#Include Label="DigraphHasNoVertices"> 6 |
7 | 8 |
Edge properties 9 | <#Include Label="DigraphHasLoops"> 10 | <#Include Label="IsAntisymmetricDigraph"> 11 | <#Include Label="IsBipartiteDigraph"> 12 | <#Include Label="IsCompleteBipartiteDigraph"> 13 | <#Include Label="IsCompleteDigraph"> 14 | <#Include Label="IsCompleteMultipartiteDigraph"> 15 | <#Include Label="IsEmptyDigraph"> 16 | <#Include Label="IsEquivalenceDigraph"> 17 | <#Include Label="IsFunctionalDigraph"> 18 | <#Include Label="IsPermutationDigraph"> 19 | <#Include Label="IsMultiDigraph"> 20 | <#Include Label="IsNonemptyDigraph"> 21 | <#Include Label="IsReflexiveDigraph"> 22 | <#Include Label="IsSymmetricDigraph"> 23 | <#Include Label="IsTournament"> 24 | <#Include Label="IsTransitiveDigraph"> 25 |
26 | 27 |
Edge Weights 28 | <#Include Label="EdgeWeights"> 29 | <#Include Label="EdgeWeightedDigraph"> 30 | <#Include Label="EdgeWeightedDigraphTotalWeight"> 31 | <#Include Label="EdgeWeightedDigraphMinimumSpanningTree"> 32 | <#Include Label="EdgeWeightedDigraphShortestPaths"> 33 | <#Include Label="EdgeWeightedDigraphShortestPath"> 34 | <#Include Label="DigraphMaximumFlow"> 35 | <#Include Label="DigraphMinimumCut"> 36 | <#Include Label="DigraphMinimumCutSet"> 37 | <#Include Label="RandomUniqueEdgeWeightedDigraph"> 38 |
39 | 40 |
Orders 41 | <#Include Label="IsPreorderDigraph"> 42 | <#Include Label="IsPartialOrderDigraph"> 43 | <#Include Label="IsMeetSemilatticeDigraph"> 44 | <#Include Label="DigraphMeetTable"> 45 | <#Include Label="IsOrderIdeal"> 46 | <#Include Label="IsOrderFilter"> 47 | <#Include Label="IsUpperSemimodularDigraph"> 48 | <#Include Label="IsDistributiveLatticeDigraph"> 49 | <#Include Label="IsModularLatticeDigraph"> 50 |
51 | 52 |
Regularity 53 | <#Include Label="IsInRegularDigraph"> 54 | <#Include Label="IsOutRegularDigraph"> 55 | <#Include Label="IsRegularDigraph"> 56 | <#Include Label="IsDistanceRegularDigraph"> 57 |
58 | 59 |
Connectivity and cycles 60 | <#Include Label="IsAcyclicDigraph"> 61 | <#Include Label="IsChainDigraph"> 62 | <#Include Label="IsConnectedDigraph"> 63 | <#Include Label="IsBiconnectedDigraph"> 64 | <#Include Label="IsBridgelessDigraph"> 65 | <#Include Label="IsStronglyConnectedDigraph"> 66 | <#Include Label="IsAperiodicDigraph"> 67 | <#Include Label="IsDirectedTree"> 68 | <#Include Label="IsUndirectedTree"> 69 | <#Include Label="IsEulerianDigraph"> 70 | <#Include Label="IsHamiltonianDigraph"> 71 | <#Include Label="IsCycleDigraph"> 72 |
73 | 74 |
Planarity 75 | <#Include Label="IsPlanarDigraph"> 76 | <#Include Label="IsOuterPlanarDigraph"> 77 |
78 | 79 |
Homomorphisms and transformations 80 | <#Include Label="IsDigraphCore"> 81 | <#Include Label="IsEdgeTransitive"> 82 | <#Include Label="IsVertexTransitive"> 83 | <#Include Label="Is2EdgeTransitive"> 84 |
85 | 86 | 87 |
88 | -------------------------------------------------------------------------------- /extern/bliss-0.73/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | # BasedOnStyle: LLVM 3 | AccessModifierOffset: -1 4 | AlignAfterOpenBracket: Align 5 | AlignConsecutiveAssignments: true 6 | AlignConsecutiveDeclarations: true 7 | AlignEscapedNewlinesLeft: true 8 | AlignOperands: true 9 | AlignTrailingComments: true 10 | AllowAllParametersOfDeclarationOnNextLine: false 11 | AllowShortBlocksOnASingleLine: false 12 | AllowShortCaseLabelsOnASingleLine: false 13 | AllowShortFunctionsOnASingleLine: Empty 14 | AllowShortIfStatementsOnASingleLine: false 15 | AllowShortLoopsOnASingleLine: false 16 | AlwaysBreakAfterReturnType: None 17 | AlwaysBreakBeforeMultilineStrings: false 18 | AlwaysBreakTemplateDeclarations: true 19 | BinPackArguments: false 20 | BinPackParameters: false 21 | BraceWrapping: 22 | AfterClass: false 23 | AfterControlStatement: false 24 | AfterEnum: false 25 | AfterFunction: false 26 | AfterNamespace: false 27 | AfterObjCDeclaration: false 28 | AfterStruct: false 29 | AfterUnion: false 30 | BeforeCatch: false 31 | BeforeElse: false 32 | IndentBraces: false 33 | BreakAfterJavaFieldAnnotations: false 34 | BreakBeforeBinaryOperators: All 35 | BreakBeforeBraces: Attach 36 | BreakBeforeInheritanceComma: false 37 | BreakBeforeTernaryOperators: true 38 | BreakConstructorInitializers: BeforeColon 39 | BreakStringLiterals: true 40 | ColumnLimit: 80 41 | CompactNamespaces: false 42 | CommentPragmas: '^ IWYU pragma:' 43 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 44 | ConstructorInitializerIndentWidth: 4 45 | ContinuationIndentWidth: 4 46 | Cpp11BracedListStyle: true 47 | DerivePointerAlignment: true 48 | DisableFormat: false 49 | ExperimentalAutoDetectBinPacking: false 50 | FixNamespaceComments: true 51 | ForEachMacros: ['RANGES_FOR', 'FOREACH'] 52 | IncludeBlocks: Preserve 53 | IncludeCategories: 54 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/' 55 | Priority: 2 56 | - Regex: '^(<|"(gtest|isl|json)/)' 57 | Priority: 3 58 | - Regex: '.*' 59 | Priority: 1 60 | IncludeIsMainRegex: '$' 61 | IndentCaseLabels: true 62 | IndentPPDirectives: None 63 | IndentWidth: 2 64 | IndentWrappedFunctionNames: false 65 | JavaScriptQuotes: Leave 66 | JavaScriptWrapImports: true 67 | KeepEmptyLinesAtTheStartOfBlocks: false 68 | Language: Cpp 69 | MacroBlockBegin: '' 70 | MacroBlockEnd: '' 71 | MaxEmptyLinesToKeep: 1 72 | NamespaceIndentation: All 73 | ObjCBlockIndentWidth: 2 74 | ObjCSpaceAfterProperty: false 75 | ObjCSpaceBeforeProtocolList: true 76 | PenaltyBreakAssignment: 2 77 | PenaltyBreakBeforeFirstCallParameter: 19 78 | PenaltyBreakComment: 300 79 | PenaltyBreakFirstLessLess: 200 80 | PenaltyBreakString: 1000 81 | PenaltyExcessCharacter: 1000000 82 | PenaltyReturnTypeOnItsOwnLine: 100 83 | PointerAlignment: Left 84 | ReflowComments: true 85 | SortIncludes: true 86 | SpaceAfterCStyleCast: true 87 | SpaceAfterTemplateKeyword: true 88 | SpaceBeforeAssignmentOperators: true 89 | #SpaceBeforeCtorInitializerColon: true 90 | #SpaceBeforeInheritanceColon: true 91 | SpaceBeforeParens: ControlStatements 92 | #SpaceBeforeRangeBasedForLoopColon: true 93 | SpaceInEmptyParentheses: false 94 | SpacesBeforeTrailingComments: 2 95 | SpacesInAngles: false 96 | SpacesInCStyleCastParentheses: false 97 | SpacesInContainerLiterals: true 98 | SpacesInParentheses: false 99 | SpacesInSquareBrackets: false 100 | Standard: Cpp03 101 | TabWidth: 2 102 | UseTab: Never 103 | ... 104 | 105 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | # Trigger the workflow manually 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | dry-run: 8 | description: "Dry run: do not actually push the release to GitHub" 9 | type: boolean 10 | required: false 11 | default: false 12 | force: 13 | description: "Allow overwriting an existing release, or making a release with an incorrect date" 14 | type: boolean 15 | required: false 16 | default: false 17 | 18 | permissions: write-all 19 | 20 | jobs: 21 | release: 22 | name: "Release the GAP package" 23 | runs-on: ubuntu-latest 24 | 25 | steps: 26 | - uses: actions/checkout@v5 27 | - uses: gap-actions/setup-gap@v3 28 | with: 29 | gap-version: latest 30 | - name: "Clone the NautyTracesInterface package (no need to build) . . ." 31 | run: | 32 | git clone https://github.com/gap-packages/NautyTracesInterface ${GAPROOT}/pkg/NautyTracesInterface 33 | - uses: gap-actions/build-pkg-docs@v2 34 | with: 35 | use-latex: true 36 | - name: "Clean up additional files . . ." 37 | run: | 38 | rm -f .mailmap .codespellrc Dockerfile 39 | rm -rf etc 40 | - name: "Extract the latest CHANGELOG entry to use as the GitHub release text . . ." 41 | run: | 42 | # Extract the part of CHANGELOG that is relevant to this release 43 | LINES=`grep -n "## Version " CHANGELOG.md | head -2 | cut -d':' -f1` 44 | 45 | # Find the line number where the relevant section starts 46 | # (Increment by 1 if that first line is empty) 47 | START=`echo $LINES | cut -d' ' -f1`; 48 | START=$((START + 1)) 49 | if [ "`sed \"${START}q;d\" CHANGELOG.md`" == "" ]; then 50 | START=$(( START + 1 )); 51 | fi 52 | 53 | # Find the line number where the relevant section ends 54 | # (Decrement by 1 if that last line is empty) 55 | STOP=`echo $LINES | cut -d' ' -f2`; 56 | STOP=$((STOP - 1)) 57 | if [ "`sed \"${STOP}q;d\" CHANGELOG.md`" == "" ]; then 58 | STOP=$(( STOP - 1 )); 59 | fi 60 | 61 | # Store the potentially multi-line text in the BODY environment so 62 | # that we can pass it to the release-pkg action as an input 63 | { 64 | echo 'BODY<> "$GITHUB_ENV" 68 | 69 | - uses: gap-actions/release-pkg@v1 70 | with: 71 | dry-run: ${{ inputs.dry-run }} 72 | force: ${{ inputs.force }} 73 | body-text: ${{ env.BODY }} 74 | 75 | - uses: gap-actions/update-gh-pages@v1 76 | with: 77 | # The option stops the action from updating the website with 78 | # the latest GitHubPagesForGAP code, because we have customised our 79 | # website (with e.g. a section linking to the Digraphs library, and 80 | # the Digraphs library itself), and these changes would be overwritten 81 | # if this option was set to , which is the default. However, 82 | # we might want to manually update the GitHubPagesForGAP code from 83 | # time to time, to receive any bugfixes or updates to parts of the 84 | # website code that we haven't customised. But this would have to be 85 | # done carefully. 86 | clean: false 87 | dry-run: ${{ inputs.dry-run }} 88 | extra-files: "CHANGELOG.md" 89 | -------------------------------------------------------------------------------- /gap/isomorph.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | ## isomorph.gd 4 | ## Copyright (C) 2014-19 James D. Mitchell 5 | ## Wilf A. Wilson 6 | ## 7 | ## Licensing information can be found in the README file of this package. 8 | ## 9 | ############################################################################# 10 | ## 11 | 12 | DeclareAttribute("AutomorphismGroup", IsDigraph); 13 | DeclareOperation("AutomorphismGroup", [IsDigraph, IsHomogeneousList]); 14 | DeclareOperation("AutomorphismGroup", [IsDigraph, IsHomogeneousList, IsList]); 15 | DeclareOperation("AutomorphismGroup", [IsDigraph, IsBool, IsList]); 16 | 17 | DeclareAttribute("BlissAutomorphismGroup", IsDigraph); 18 | DeclareOperation("BlissAutomorphismGroup", [IsDigraph, IsHomogeneousList]); 19 | DeclareOperation("BlissAutomorphismGroup", 20 | [IsDigraph, IsHomogeneousList, IsList]); 21 | DeclareOperation("BlissAutomorphismGroup", [IsDigraph, IsBool, IsList]); 22 | 23 | DeclareAttribute("NautyAutomorphismGroup", IsDigraph); 24 | DeclareOperation("NautyAutomorphismGroup", [IsDigraph, IsHomogeneousList]); 25 | DeclareOperation("NautyAutomorphismGroup", 26 | [IsDigraph, IsHomogeneousList, IsList]); 27 | DeclareOperation("NautyAutomorphismGroup", [IsDigraph, IsBool, IsList]); 28 | 29 | DeclareAttribute("BlissCanonicalLabelling", IsDigraph); 30 | DeclareOperation("BlissCanonicalLabelling", [IsDigraph, IsHomogeneousList]); 31 | 32 | DeclareAttribute("NautyCanonicalLabelling", IsDigraph); 33 | DeclareOperation("NautyCanonicalLabelling", [IsDigraph, IsHomogeneousList]); 34 | 35 | DeclareAttributeThatReturnsDigraph("BlissCanonicalDigraph", IsDigraph); 36 | DeclareOperation("BlissCanonicalDigraph", [IsDigraph, IsHomogeneousList]); 37 | 38 | # TODO document 2-arg BlissCanonicalDigraph and NautyCanonicalDigraph 39 | 40 | DeclareAttributeThatReturnsDigraph("NautyCanonicalDigraph", IsDigraph); 41 | DeclareOperation("NautyCanonicalDigraph", [IsDigraph, IsHomogeneousList]); 42 | 43 | DeclareOperation("IsIsomorphicDigraph", [IsDigraph, IsDigraph]); 44 | DeclareOperation("IsIsomorphicDigraph", 45 | [IsDigraph, IsDigraph, IsHomogeneousList, IsHomogeneousList]); 46 | DeclareOperation("IsomorphismDigraphs", [IsDigraph, IsDigraph]); 47 | DeclareOperation("IsomorphismDigraphs", 48 | [IsDigraph, IsDigraph, IsHomogeneousList, IsHomogeneousList]); 49 | 50 | DeclareGlobalFunction("DigraphsUseBliss"); 51 | DeclareGlobalFunction("DigraphsUseNauty"); 52 | 53 | BindGlobal("DIGRAPHS_UsingBliss", true); 54 | 55 | DeclareGlobalFunction("DIGRAPHS_ValidateVertexColouring"); 56 | DeclareGlobalFunction("DIGRAPHS_ValidateEdgeColouring"); 57 | DeclareGlobalFunction("DIGRAPHS_CollapseMultiColouredEdges"); 58 | DeclareGlobalFunction("DIGRAPHS_CollapseMultipleEdges"); 59 | 60 | DeclareOperation("IsDigraphAutomorphism", 61 | [IsDigraph, IsPerm]); 62 | DeclareOperation("IsDigraphAutomorphism", 63 | [IsDigraph, IsPerm, IsList]); 64 | DeclareOperation("IsDigraphAutomorphism", 65 | [IsDigraph, IsTransformation]); 66 | DeclareOperation("IsDigraphAutomorphism", 67 | [IsDigraph, IsTransformation, IsList]); 68 | 69 | DeclareOperation("IsDigraphIsomorphism", [IsDigraph, IsDigraph, IsPerm]); 70 | DeclareOperation("IsDigraphIsomorphism", 71 | [IsDigraph, IsDigraph, IsPerm, IsList, IsList]); 72 | DeclareOperation("IsDigraphIsomorphism", 73 | [IsDigraph, IsDigraph, IsTransformation]); 74 | DeclareOperation("IsDigraphIsomorphism", 75 | [IsDigraph, IsDigraph, IsTransformation, IsList, IsList]); 76 | -------------------------------------------------------------------------------- /src/homos-graphs.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** 3 | ** homos-graphs.h (Di)graphs for the homomorphism finder J. D. Mitchell 4 | ** 5 | ** Copyright (C) 2019 - J. D. Mitchell 6 | ** 7 | ** This file is free software, see the digraphs/LICENSE. 8 | ** 9 | ********************************************************************************/ 10 | 11 | #ifndef DIGRAPHS_SRC_HOMOS_GRAPHS_H_ 12 | #define DIGRAPHS_SRC_HOMOS_GRAPHS_H_ 13 | 14 | // C headers 15 | #include // for bool 16 | #include // for uint16_t 17 | 18 | // Digraphs headers 19 | #include "bitarray.h" // for BitArray 20 | #include "bliss-includes.h" // for bliss stuff 21 | #include "digraphs-config.h" // for DIGRAPHS_WITH_INCLUDED_BLISS 22 | #include "digraphs-debug.h" // for DIGRAPHS_ASSERT 23 | #include "perms.h" // for PermColl 24 | 25 | //////////////////////////////////////////////////////////////////////// 26 | // Directed graphs (digraphs) 27 | //////////////////////////////////////////////////////////////////////// 28 | 29 | struct digraph_struct { 30 | BitArray** in_neighbours; 31 | BitArray** out_neighbours; 32 | uint16_t nr_vertices; 33 | uint16_t capacity; 34 | }; 35 | 36 | typedef struct digraph_struct Digraph; 37 | 38 | Digraph* new_digraph(uint16_t const); 39 | 40 | void free_digraph(Digraph* const); 41 | void clear_digraph(Digraph* const, uint16_t const); 42 | void add_edge_digraph(Digraph* const, uint16_t const, uint16_t const); 43 | 44 | static inline bool is_adjacent_digraph(Digraph const* const digraph, 45 | uint16_t const i, 46 | uint16_t const j) { 47 | DIGRAPHS_ASSERT(digraph != NULL); 48 | DIGRAPHS_ASSERT(i < digraph->nr_vertices); 49 | DIGRAPHS_ASSERT(j < digraph->nr_vertices); 50 | return get_bit_array(digraph->out_neighbours[i], j); 51 | } 52 | 53 | #ifdef DIGRAPHS_WITH_INCLUDED_BLISS 54 | void automorphisms_digraph(Digraph const* const, 55 | uint16_t const* const, 56 | PermColl*, 57 | BlissGraph*); 58 | #else 59 | void automorphisms_digraph(Digraph const* const, 60 | uint16_t const* const, 61 | PermColl*); 62 | #endif 63 | 64 | //////////////////////////////////////////////////////////////////////// 65 | // Undirected graphs (graphs) 66 | //////////////////////////////////////////////////////////////////////// 67 | 68 | struct graph_struct { 69 | BitArray** neighbours; 70 | uint16_t nr_vertices; 71 | uint16_t capacity; 72 | }; 73 | 74 | typedef struct graph_struct Graph; 75 | 76 | Graph* new_graph(uint16_t const); 77 | 78 | void free_graph(Graph* const); 79 | void clear_graph(Graph* const, uint16_t const); 80 | void add_edge_graph(Graph* const, uint16_t const, uint16_t const); 81 | 82 | static inline bool is_adjacent_graph(Graph const* const graph, 83 | uint16_t const i, 84 | uint16_t const j) { 85 | DIGRAPHS_ASSERT(graph != NULL); 86 | DIGRAPHS_ASSERT(i < graph->nr_vertices); 87 | DIGRAPHS_ASSERT(j < graph->nr_vertices); 88 | return get_bit_array(graph->neighbours[i], j); 89 | } 90 | 91 | #ifdef DIGRAPHS_WITH_INCLUDED_BLISS 92 | void automorphisms_graph(Graph const* const, 93 | uint16_t const* const, 94 | PermColl*, 95 | BlissGraph*); 96 | #else 97 | void automorphisms_graph(Graph const* const, uint16_t const* const, PermColl*); 98 | #endif 99 | #endif // DIGRAPHS_SRC_HOMOS_GRAPHS_H_ 100 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/planarityApp/planarityTransformGraph.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1997-2025, John M. Boyer 3 | All rights reserved. 4 | See the LICENSE.TXT file for licensing information. 5 | */ 6 | 7 | #include "planarity.h" 8 | 9 | int transformFile(graphP theGraph, char *infileName); 10 | int transformString(graphP theGraph, char *inputStr); 11 | 12 | /**************************************************************************** 13 | TransformGraph() 14 | commandString - command to run; i.e. `-(gam)` to transform graph to .g6, adjacency list, or 15 | adjacency matrix format 16 | infileName - name of file to read, or NULL to cause the program to prompt the user for a filename 17 | inputStr - string containing input graph, or NULL to cause the program to fall back on reading from file 18 | outputBase - pointer to the flag set for whether output is 0- or 1-based 19 | outputFormat - output format 20 | outfileName - name of primary output file, or NULL to construct an output filename based on the input 21 | outputStr - pointer to string which we wish to use to store the transformation output 22 | ****************************************************************************/ 23 | int TransformGraph(char *commandString, char *infileName, char *inputStr, int *outputBase, char *outfileName, char **outputStr) 24 | { 25 | int Result = OK; 26 | 27 | graphP theGraph; 28 | 29 | theGraph = gp_New(); 30 | 31 | int outputFormat = -1; 32 | 33 | if (commandString[0] == '-') 34 | { 35 | if (commandString[1] == 'g') 36 | outputFormat = WRITE_G6; 37 | else if (commandString[1] == 'a') 38 | outputFormat = WRITE_ADJLIST; 39 | else if (commandString[1] == 'm') 40 | outputFormat = WRITE_ADJMATRIX; 41 | else 42 | { 43 | ErrorMessage("Invalid argument; only -(gam) is allowed.\n"); 44 | return NOTOK; 45 | } 46 | 47 | if (inputStr) 48 | Result = transformString(theGraph, inputStr); 49 | else 50 | Result = transformFile(theGraph, infileName); 51 | 52 | if (Result != OK) 53 | { 54 | ErrorMessage("Unable to transform input graph.\n"); 55 | } 56 | else 57 | { 58 | // Want to know whether the output is 0- or 1-based; will always be 59 | // 0-based for transformations of .g6 input 60 | if (outputBase != NULL) 61 | (*outputBase) = (theGraph->internalFlags & FLAGS_ZEROBASEDIO) ? 1 : 0; 62 | 63 | if (outputStr != NULL) 64 | Result = gp_WriteToString(theGraph, outputStr, outputFormat); 65 | else 66 | Result = gp_Write(theGraph, outfileName, outputFormat); 67 | 68 | if (Result != OK) 69 | ErrorMessage("Unable to write graph.\n"); 70 | } 71 | } 72 | else 73 | { 74 | ErrorMessage("Invalid argument; must start with '-'.\n"); 75 | Result = NOTOK; 76 | } 77 | 78 | gp_Free(&theGraph); 79 | return Result; 80 | } 81 | 82 | int transformFile(graphP theGraph, char *infileName) 83 | { 84 | if (infileName == NULL) 85 | { 86 | if ((infileName = ConstructInputFilename(infileName)) == NULL) 87 | return NOTOK; 88 | } 89 | 90 | return gp_Read(theGraph, infileName); 91 | } 92 | 93 | int transformString(graphP theGraph, char *inputStr) 94 | { 95 | if (inputStr == NULL || strlen(inputStr) == 0) 96 | { 97 | ErrorMessage("Input string is null or empty.\n"); 98 | return NOTOK; 99 | } 100 | 101 | return gp_ReadFromString(theGraph, inputStr); 102 | } 103 | -------------------------------------------------------------------------------- /extern/bliss-0.73/kstack.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_KSTACK_H 2 | #define BLISS_KSTACK_H 3 | 4 | /* 5 | Copyright (c) 2003-2015 Tommi Junttila 6 | Released under the GNU Lesser General Public License version 3. 7 | 8 | This file is part of bliss. 9 | 10 | bliss is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation, version 3 of the License. 13 | 14 | bliss is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with bliss. If not, see . 21 | */ 22 | 23 | #include 24 | #include "defs.hh" 25 | 26 | namespace bliss_digraphs { 27 | 28 | /** \internal 29 | * \brief A very simple implementation of a stack with fixed capacity. 30 | */ 31 | template 32 | class KStack { 33 | public: 34 | /** 35 | * Create a new stack with zero capacity. 36 | * The function init() should be called next. 37 | */ 38 | KStack(); 39 | 40 | /** 41 | * Create a new stack with the capacity to hold at most \a N elements. 42 | */ 43 | KStack(int N); 44 | 45 | ~KStack(); 46 | 47 | /** 48 | * Initialize the stack to have the capacity to hold at most \a N elements. 49 | */ 50 | void init(int N); 51 | 52 | /** 53 | * Is the stack empty? 54 | */ 55 | bool is_empty() const {return(cursor == entries); } 56 | 57 | /** 58 | * Return (but don't remove) the top element of the stack. 59 | */ 60 | Type top() const {BLISS_ASSERT(cursor > entries); return *cursor; } 61 | 62 | /** 63 | * Pop (remove) the top element of the stack. 64 | */ 65 | Type pop() 66 | { 67 | return *cursor--; 68 | } 69 | 70 | /** 71 | * Push the element \a e in the stack. 72 | */ 73 | void push(Type e) 74 | { 75 | *(++cursor) = e; 76 | } 77 | 78 | /** Remove all the elements in the stack. */ 79 | void clean() {cursor = entries; } 80 | 81 | /** 82 | * Get the number of elements in the stack. 83 | */ 84 | unsigned int size() const {return(cursor - entries); } 85 | 86 | /** 87 | * Return the i:th element in the stack, where \a i is in the range 88 | * 0,...,this.size()-1; the 0:th element is the bottom element 89 | * in the stack. 90 | */ 91 | Type element_at(unsigned int i) 92 | { 93 | assert(i < size()); 94 | return entries[i+1]; 95 | } 96 | 97 | /** Return the capacity (NOT the number of elements) of the stack. */ 98 | int capacity() {return kapacity; } 99 | private: 100 | int kapacity; 101 | typedef typename std::vector::iterator entries_pointer_substitute; 102 | std::vector entries_vec; 103 | entries_pointer_substitute entries; 104 | entries_pointer_substitute cursor; 105 | }; 106 | 107 | template 108 | KStack::KStack() 109 | { 110 | kapacity = 0; 111 | } 112 | 113 | template 114 | KStack::KStack(int k) 115 | { 116 | assert(k > 0); 117 | kapacity = k; 118 | entries_vec.resize(k + 1); 119 | entries = entries_vec.begin(); 120 | cursor = entries; 121 | } 122 | 123 | template 124 | void KStack::init(int k) 125 | { 126 | assert(k > 0); 127 | kapacity = k; 128 | entries_vec.resize(k + 1); 129 | entries = entries_vec.begin(); 130 | cursor = entries; 131 | } 132 | 133 | template 134 | KStack::~KStack() 135 | { 136 | } 137 | 138 | } // namespace bliss_digraphs 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/c/graphLib/planarityRelated/graphDrawPlanar.private.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPH_DRAWPLANAR_PRIVATE_H 2 | #define GRAPH_DRAWPLANAR_PRIVATE_H 3 | 4 | /* 5 | Copyright (c) 1997-2025, John M. Boyer 6 | All rights reserved. 7 | See the LICENSE.TXT file for licensing information. 8 | */ 9 | 10 | #include "../graph.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif 16 | 17 | // Additional equipment for each edge 18 | /* 19 | pos, start, end: used to store a visibility representation, or 20 | horvert diagram of a planar graph. 21 | For edges, horizontal position, vertical range 22 | */ 23 | typedef struct 24 | { 25 | int pos, start, end; 26 | } DrawPlanar_EdgeRec; 27 | 28 | typedef DrawPlanar_EdgeRec *DrawPlanar_EdgeRecP; 29 | 30 | // Additional equipment for each vertex 31 | /* 32 | pos, start, end: used to store a visibility representation, or 33 | horvert diagram, of a planar graph. 34 | For vertices, vertical position, horizontal range 35 | drawingFlag, ancestor, ancestorChild: used to collect information needed 36 | to help 'draw' a visibility representation. During planar 37 | embedding, a vertex is determined to be between its DFS parent and 38 | a given ancestor (the vertex being processed) or beyond the parent 39 | relative to the ancestor. In post processing, the relative 40 | orientation of the parent and ancestor are determined, 41 | then the notion of between/beyond resolves to above/below or 42 | below/above depending on whether the ancestor is above or below, 43 | respectively, the parent. The ancestorChild are used to help r 44 | esolve this latter question. 45 | tie[2] stores information along the external face during embedding 46 | that is pertinent to helping break ties in the decisions about 47 | vertical vertex positioning. When vertices are first merged 48 | together into a bicomp, we cannot always decide right away which 49 | vertices will be above or below others. But as we traverse the 50 | external face removing inactive vertices, these positional ties 51 | can be resolved. 52 | */ 53 | typedef struct 54 | { 55 | int pos, start, end; 56 | int drawingFlag, ancestor, ancestorChild; 57 | int tie[2]; 58 | } DrawPlanar_VertexInfo; 59 | 60 | typedef DrawPlanar_VertexInfo *DrawPlanar_VertexInfoP; 61 | 62 | #define DRAWINGFLAG_BEYOND 0 63 | #define DRAWINGFLAG_TIE 1 64 | #define DRAWINGFLAG_BETWEEN 2 65 | #define DRAWINGFLAG_BELOW 3 66 | #define DRAWINGFLAG_ABOVE 4 67 | 68 | typedef struct 69 | { 70 | // Helps distinguish initialize from re-initialize 71 | int initialized; 72 | 73 | // The graph that this context augments 74 | graphP theGraph; 75 | 76 | // Parallel array for additional edge level equipment 77 | DrawPlanar_EdgeRecP E; 78 | 79 | // Parallel array for additional vertex level equipment 80 | DrawPlanar_VertexInfoP VI; 81 | 82 | // Overloaded function pointers 83 | graphFunctionTable functions; 84 | 85 | } DrawPlanarContext; 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /extern/bliss-0.73/bignum.hh: -------------------------------------------------------------------------------- 1 | #ifndef BLISS_BIGNUM_HH 2 | #define BLISS_BIGNUM_HH 3 | 4 | /* 5 | Copyright (c) 2003-2015 Tommi Junttila 6 | Released under the GNU Lesser General Public License version 3. 7 | 8 | This file is part of bliss. 9 | 10 | bliss is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published by 12 | the Free Software Foundation, version 3 of the License. 13 | 14 | bliss is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with bliss. If not, see . 21 | */ 22 | 23 | #if defined(BLISS_USE_GMP) 24 | #include 25 | #endif 26 | 27 | #include 28 | #include 29 | #include "defs.hh" 30 | 31 | namespace bliss_digraphs { 32 | 33 | /** 34 | * \brief A very simple class for big integers (or approximation of them). 35 | * 36 | * If the compile time flag BLISS_USE_GMP is set, 37 | * then the GNU Multiple Precision Arithmetic library (GMP) is used to 38 | * obtain arbitrary precision, otherwise "long double" is used to 39 | * approximate big integers. 40 | */ 41 | 42 | /// Addition by Chris Jefferson, 16 Jan 2020, for use in GAP. 43 | /// Store the size of the group as a list of integers, to be 44 | /// multiplied together later. 45 | #define BLISS_IN_GAP 46 | 47 | #ifdef BLISS_IN_GAP 48 | class BigNum 49 | { 50 | std::vector v; 51 | public: 52 | /** 53 | * Create a new big number and set it to zero. 54 | */ 55 | BigNum() { } 56 | 57 | /** 58 | * Destroy the number. 59 | */ 60 | ~BigNum() { } 61 | 62 | /** 63 | * Set the number to \a n. 64 | */ 65 | void assign(const int n) { v.clear(); v.push_back(n); } 66 | 67 | /** 68 | * Multiply the number with \a n. 69 | */ 70 | void multiply(const int n) { v.push_back(n); } 71 | 72 | /** 73 | * Print the number in the file stream \a fp. 74 | */ 75 | size_t print(FILE* const fp) const {return fprintf(fp, ""); } 76 | 77 | std::vector get_mults() const { 78 | return v; 79 | } 80 | }; 81 | 82 | #elif defined(BLISS_USE_GMP) 83 | 84 | class BigNum 85 | { 86 | mpz_t v; 87 | public: 88 | /** 89 | * Create a new big number and set it to zero. 90 | */ 91 | BigNum() {mpz_init(v); } 92 | 93 | /** 94 | * Destroy the number. 95 | */ 96 | ~BigNum() {mpz_clear(v); } 97 | 98 | /** 99 | * Set the number to \a n. 100 | */ 101 | void assign(const int n) {mpz_set_si(v, n); } 102 | 103 | /** 104 | * Multiply the number with \a n. 105 | */ 106 | void multiply(const int n) {mpz_mul_si(v, v, n); } 107 | 108 | /** 109 | * Print the number in the file stream \a fp. 110 | */ 111 | size_t print(FILE* const fp) const {return mpz_out_str(fp, 10, v); } 112 | }; 113 | 114 | #else 115 | 116 | class BigNum 117 | { 118 | long double v; 119 | public: 120 | /** 121 | * Create a new big number and set it to zero. 122 | */ 123 | BigNum(): v(0.0) {} 124 | 125 | /** 126 | * Set the number to \a n. 127 | */ 128 | void assign(const int n) {v = (long double)n; } 129 | 130 | /** 131 | * Multiply the number with \a n. 132 | */ 133 | void multiply(const int n) {v *= (long double)n; } 134 | 135 | /** 136 | * Print the number in the file stream \a fp. 137 | */ 138 | size_t print(FILE* const fp) const {return fprintf(fp, "%Lg", v); } 139 | }; 140 | 141 | #endif 142 | 143 | } //namespace bliss_digraphs 144 | 145 | #endif 146 | -------------------------------------------------------------------------------- /extern/edge-addition-planarity-suite-Version_4.0.0.0/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = c/samples 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | lib_LTLIBRARIES = libplanarity.la 6 | 7 | libplanarity_la_SOURCES = \ 8 | c/graphLib/graphDFSUtils.c \ 9 | c/graphLib/graphUtils.c \ 10 | c/graphLib/extensionSystem/graphExtensions.c \ 11 | c/graphLib/homeomorphSearch/graphK23Search.c \ 12 | c/graphLib/homeomorphSearch/graphK23Search_Extensions.c \ 13 | c/graphLib/homeomorphSearch/graphK33Search.c \ 14 | c/graphLib/homeomorphSearch/graphK33Search_Extensions.c \ 15 | c/graphLib/homeomorphSearch/graphK4Search.c \ 16 | c/graphLib/homeomorphSearch/graphK4Search_Extensions.c \ 17 | c/graphLib/io/g6-api-utilities.c \ 18 | c/graphLib/io/g6-read-iterator.c \ 19 | c/graphLib/io/g6-write-iterator.c \ 20 | c/graphLib/io/graphIO.c \ 21 | c/graphLib/io/strbuf.c \ 22 | c/graphLib/io/strOrFile.c \ 23 | c/graphLib/lowLevelUtils/apiutils.c \ 24 | c/graphLib/lowLevelUtils/listcoll.c \ 25 | c/graphLib/lowLevelUtils/stack.c \ 26 | c/graphLib/planarityRelated/graphDrawPlanar.c \ 27 | c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c \ 28 | c/graphLib/planarityRelated/graphEmbed.c \ 29 | c/graphLib/planarityRelated/graphIsolator.c \ 30 | c/graphLib/planarityRelated/graphNonplanar.c \ 31 | c/graphLib/planarityRelated/graphOuterplanarObstruction.c \ 32 | c/graphLib/planarityRelated/graphTests.c 33 | 34 | libplanarity_la_LDFLAGS = -no-undefined $(AM_LDFLAGS) -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ 35 | 36 | # These pkgincludes are added without "nobase_" so that the files will be copied to the 37 | # root of the planarity project includedir (i.e. excluding the c subdirectory) 38 | pkginclude_HEADERS = \ 39 | c/graph.h \ 40 | c/graphLib.h 41 | 42 | # This is the full set of pkgincludes for which "nobase_" has been used to ensure that 43 | # the directory structure is retained when installing the planarity headers. 44 | nobase_pkginclude_HEADERS = \ 45 | c/graphLib/graph.h \ 46 | c/graphLib/graphLib.h \ 47 | c/graphLib/graphStructures.h \ 48 | c/graphLib/extensionSystem/graphExtensions.h \ 49 | c/graphLib/extensionSystem/graphExtensions.private.h \ 50 | c/graphLib/extensionSystem/graphFunctionTable.h \ 51 | c/graphLib/homeomorphSearch/graphK23Search.h \ 52 | c/graphLib/homeomorphSearch/graphK23Search.private.h \ 53 | c/graphLib/homeomorphSearch/graphK33Search.h \ 54 | c/graphLib/homeomorphSearch/graphK33Search.private.h \ 55 | c/graphLib/homeomorphSearch/graphK4Search.h \ 56 | c/graphLib/homeomorphSearch/graphK4Search.private.h \ 57 | c/graphLib/io/g6-api-utilities.h \ 58 | c/graphLib/io/g6-read-iterator.h \ 59 | c/graphLib/io/g6-write-iterator.h \ 60 | c/graphLib/io/strbuf.h \ 61 | c/graphLib/io/strOrFile.h \ 62 | c/graphLib/lowLevelUtils/apiutils.h \ 63 | c/graphLib/lowLevelUtils/appconst.h \ 64 | c/graphLib/lowLevelUtils/listcoll.h \ 65 | c/graphLib/lowLevelUtils/platformTime.h \ 66 | c/graphLib/lowLevelUtils/stack.h \ 67 | c/graphLib/planarityRelated/graphDrawPlanar.h \ 68 | c/graphLib/planarityRelated/graphDrawPlanar.private.h \ 69 | c/planarityApp/planarity.h 70 | 71 | bin_PROGRAMS = planarity 72 | planarity_LDADD = libplanarity.la 73 | planarity_SOURCES = \ 74 | c/planarityApp/planarity.c \ 75 | c/planarityApp/planarityCommandLine.c \ 76 | c/planarityApp/planarityHelp.c \ 77 | c/planarityApp/planarityMenu.c \ 78 | c/planarityApp/planarityRandomGraphs.c \ 79 | c/planarityApp/planaritySpecificGraph.c \ 80 | c/planarityApp/planarityTransformGraph.c \ 81 | c/planarityApp/planarityTestAllGraphs.c \ 82 | c/planarityApp/planarityUtils.c 83 | 84 | man1_MANS = c/planarityApp/planarity.1 85 | EXTRA_DIST=$(man1_MANS) 86 | 87 | TESTS = test-samples.sh 88 | 89 | # The @docdir@ variable will be replaced by the ./configure script. 90 | docdir = @docdir@ 91 | dist_doc_DATA = README.md LICENSE.TXT 92 | 93 | pkgconfig_DATA = libplanarity.pc 94 | -------------------------------------------------------------------------------- /doc/utils.xml: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W utils.xml 4 | #Y Copyright (C) 2015 Michael C. Young 5 | ## 6 | ## Licensing information can be found in the README file of this package. 7 | ## 8 | ############################################################################# 9 | ## 10 | 11 | <#GAPDoc Label="DigraphsMakeDoc"> 12 | 13 | 14 | Nothing 15 | 16 | This function should be called with no argument to compile the &Digraphs; 17 | documentation. 18 | 19 | 20 | <#/GAPDoc> 21 | 22 | <#GAPDoc Label="DigraphsTestAll"> 23 | 24 | 25 | Nothing. 26 | 27 | This function should be called to comprehensively test that &Digraphs; is 28 | working correctly. These tests should take no more than a few minutes to 29 | complete. The tests will include compiling the package's documentation and 30 | running all the examples included in the manual.

31 | 32 | To quickly test that &Digraphs; is installed correctly use . 34 | 35 | 36 | <#/GAPDoc> 37 | 38 | <#GAPDoc Label="DigraphsTestStandard"> 39 | 40 | 41 | true or false. 42 | 43 | This function can be called without arguments to test all of the methods 44 | included in &Digraphs;. 45 | These tests should take less than a minute to complete.

46 | 47 | To quickly test that &Digraphs; is installed correctly use . For a more thorough test, use . 50 | 51 | 52 | <#/GAPDoc> 53 | 54 | <#GAPDoc Label="DigraphsTestExtreme"> 55 | 56 | 57 | true or false. 58 | 59 | This function should be called with no argument. It executes a series of 60 | very demanding tests, which measure the performance of a variety of 61 | functions on large examples. These tests take a long time to 62 | complete, at least several minutes.

63 | 64 | For these tests to complete, the digraphs library digraphs-lib must 65 | be downloaded and placed in the digraphs directory in a subfolder 66 | named digraphs-lib. 67 | This library can be found in the &DIGRAPHS_LIB; repository. 68 | 69 | 70 | <#/GAPDoc> 71 | 72 | <#GAPDoc Label="DigraphsTestInstall"> 73 | 74 | 75 | true or false. 76 | 77 | This function can be called without arguments to test your installation of 78 | &Digraphs; is working correctly. These tests should take no more than a 79 | few seconds to complete. To test more comprehensively that 80 | &Digraphs; is working correctly, use . 81 | 82 | 83 | <#/GAPDoc> 84 | 85 | <#GAPDoc Label="DigraphsTestManualExamples"> 86 | 87 | 88 | Nothing. 89 | 90 | This function can be called without arguments to test the examples in the 91 | &Digraphs; manual. These tests should take no more than a few minutes to 92 | complete. To more comprehensively test that &Digraphs; is installed 93 | correctly use . See also . 95 | 96 | 97 | <#/GAPDoc> 98 | -------------------------------------------------------------------------------- /src/perms.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | ** 3 | *A perms.h permutations Julius Jonusas 4 | ** James Mitchell 5 | ** Wilf A. Wilson 6 | ** Michael Young 7 | ** 8 | ** Copyright (C) 2014-15 - Julius Jonusas, James Mitchell, Wilf A. Wilson, 9 | ** Michael Young 10 | ** 11 | ** This file is free software, see the digraphs/LICENSE. 12 | ** 13 | *******************************************************************************/ 14 | 15 | #ifndef DIGRAPHS_SRC_PERMS_H_ 16 | #define DIGRAPHS_SRC_PERMS_H_ 17 | 18 | #include // for bool, false, true 19 | #include // for uint16_t, uint64_t 20 | #include // memcpy, size_t 21 | 22 | #include "digraphs-debug.h" // for DIGRAPHS_ASSERT 23 | 24 | // GAP headers 25 | #include "gap-includes.h" 26 | 27 | // Maximum number of vertices that can be stored in 2^16 bits, 28 | // with 2 bits reserved. 29 | #define MAXVERTS 65534 30 | 31 | // smallest positive integer that doesn't fit into a small integer object 32 | #define SMALLINTLIMIT (INT_INTOBJ_MAX + 1) 33 | 34 | typedef uint16_t* Perm; 35 | 36 | Perm new_perm(uint16_t const); 37 | 38 | Perm new_perm_from_gap(Obj, uint16_t const); 39 | 40 | static inline void id_perm(Perm x, uint16_t const degree) { 41 | DIGRAPHS_ASSERT(degree <= MAXVERTS); 42 | for (uint16_t i = 0; i < degree; i++) { 43 | x[i] = i; 44 | } 45 | } 46 | 47 | static inline bool is_one(Perm const x, uint16_t const degree) { 48 | DIGRAPHS_ASSERT(degree <= MAXVERTS); 49 | for (uint16_t i = 0; i < degree; i++) { 50 | if (x[i] != i) { 51 | return false; 52 | } 53 | } 54 | return true; 55 | } 56 | 57 | static inline bool eq_perms(Perm const x, Perm const y, uint16_t const degree) { 58 | DIGRAPHS_ASSERT(degree <= MAXVERTS); 59 | for (uint16_t i = 0; i < degree; i++) { 60 | if (x[i] != y[i]) { 61 | return false; 62 | } 63 | } 64 | return true; 65 | } 66 | 67 | static inline void 68 | prod_perms(Perm xy, Perm const x, Perm const y, uint16_t const degree) { 69 | DIGRAPHS_ASSERT(x != y); 70 | DIGRAPHS_ASSERT(xy != y); 71 | for (uint16_t i = 0; i < degree; i++) { 72 | xy[i] = y[x[i]]; 73 | } 74 | } 75 | 76 | static inline void invert_perm(Perm x, Perm const y, uint16_t const degree) { 77 | DIGRAPHS_ASSERT(degree <= MAXVERTS); 78 | for (uint16_t i = 0; i < degree; i++) { 79 | x[y[i]] = i; 80 | } 81 | } 82 | 83 | static inline void copy_perm(Perm x, Perm const y, uint16_t const degree) { 84 | memcpy((void*) x, (void*) y, (size_t) degree * sizeof(uint16_t)); 85 | } 86 | 87 | struct perm_coll { 88 | Perm* perms; 89 | uint16_t size; 90 | uint16_t degree; 91 | uint16_t capacity; 92 | }; 93 | 94 | typedef struct perm_coll PermColl; 95 | 96 | PermColl* new_perm_coll(uint16_t const, uint16_t const); 97 | 98 | static inline void clear_perm_coll(PermColl* coll) { 99 | coll->size = 0; 100 | } 101 | 102 | static inline void add_perm_coll(PermColl* coll, Perm const gen) { 103 | DIGRAPHS_ASSERT(coll->size < coll->capacity); 104 | DIGRAPHS_ASSERT(coll->size < coll->degree); 105 | copy_perm(coll->perms[(coll->size)++], gen, coll->degree); 106 | } 107 | 108 | static inline void copy_perm_coll(PermColl* coll1, PermColl const* coll2) { 109 | DIGRAPHS_ASSERT(coll1->capacity >= coll2->size); 110 | clear_perm_coll(coll1); 111 | coll1->degree = coll2->degree; 112 | for (uint16_t i = 0; i < coll2->size; i++) { 113 | add_perm_coll(coll1, coll2->perms[i]); 114 | } 115 | } 116 | 117 | void free_perm_coll(PermColl* coll); 118 | 119 | #endif // DIGRAPHS_SRC_PERMS_H_ 120 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu.yml: -------------------------------------------------------------------------------- 1 | name: Ubuntu 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | - stable-*.* 9 | schedule: 10 | # Every day at 3:30 AM UTC 11 | - cron: 30 3 * * * 12 | 13 | concurrency: 14 | # Group by workflow and ref; the last component ensures that for pull requests 15 | # we limit to one concurrent job, but for the main/stable branches we don't 16 | group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/heads/stable-')) || github.run_number }} 17 | # Only cancel intermediate pull request builds 18 | cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} 19 | 20 | jobs: 21 | test-unix: 22 | name: "GAP ${{ matrix.gap-version }} / ${{ matrix.mode == 'onlyneeded' && 'only needed' || 'needed+suggested' }} packages" 23 | runs-on: ubuntu-latest 24 | strategy: 25 | fail-fast: false 26 | matrix: 27 | gap-version: 28 | - master 29 | - stable-4.15 30 | - v4.14 31 | - v4.13 32 | - v4.12 33 | mode: 34 | - onlyneeded 35 | - default 36 | include: 37 | - mode: onlyneeded 38 | pkgs-to-clone: https://github.com/digraphs/graphviz.git 39 | pkgs-to-build: io orb datastructures profiling 40 | - mode: default 41 | pkgs-to-clone: https://github.com/digraphs/graphviz.git https://github.com/gap-packages/NautyTracesInterface.git 42 | pkgs-to-build: io orb datastructures profiling grape NautyTracesInterface 43 | 44 | - gap-version: v4.11 # Note: NautyTracesInterface requires GAP 4.12 45 | mode: default # There wouldn't be much point testing GAP v4.11 with only needed packages. The only difference is whether Grape is loaded. 46 | pkgs-to-clone: https://github.com/digraphs/graphviz.git 47 | pkgs-to-build: io* orb* datastructures* profiling* grape* 48 | 49 | steps: 50 | - uses: actions/checkout@v5 51 | - name: Output g++ version . . . 52 | run: g++ --version 53 | - name: "Install GAP . . ." 54 | uses: gap-actions/setup-gap@v3 55 | with: 56 | gap-version: ${{ matrix.gap-version }} 57 | - name: "Build Digraphs . . ." 58 | uses: gap-actions/build-pkg@v2 59 | - name: "Clone additional GAP packages . . ." 60 | run: | 61 | for PKG in ${{ matrix.pkgs-to-clone }}; do 62 | cd ${GAPROOT}/pkg 63 | git clone $PKG 64 | done 65 | - name: "Build relevant GAP packages . . ." 66 | run: | 67 | cd ${GAPROOT}/pkg 68 | ../bin/BuildPackages.sh --strict ${{ matrix.pkgs-to-build }} 69 | - name: "Install digraphs-lib . . ." 70 | uses: actions/checkout@v5 71 | with: 72 | repository: digraphs/digraphs-lib 73 | path: digraphs-lib 74 | - name: "Run DigraphsTestInstall . . ." 75 | uses: gap-actions/run-pkg-tests@v4 76 | with: 77 | testfile: tst/github_actions/install.g 78 | mode: ${{ matrix.mode }} 79 | - name: "Run DigraphsTestStandard . . ." 80 | uses: gap-actions/run-pkg-tests@v4 81 | with: 82 | testfile: tst/github_actions/standard.g 83 | mode: ${{ matrix.mode }} 84 | - name: "Run DigraphsTestManualExamples . . ." 85 | uses: gap-actions/run-pkg-tests@v4 86 | with: 87 | testfile: tst/github_actions/examples.g 88 | mode: ${{ matrix.mode }} 89 | - name: "Run DigraphsTestExtreme . . ." 90 | uses: gap-actions/run-pkg-tests@v4 91 | with: 92 | testfile: tst/github_actions/extreme.g 93 | mode: ${{ matrix.mode }} 94 | - uses: gap-actions/process-coverage@v3 95 | - uses: codecov/codecov-action@v5 96 | with: 97 | token: ${{ secrets.CODECOV_TOKEN }} 98 | fail_ci_if_error: true 99 | -------------------------------------------------------------------------------- /doc/z-chap6.xml: -------------------------------------------------------------------------------- 1 | Homomorphisms 2 | 10 | 11 |

Acting on digraphs 12 | <#Include Label="OnDigraphs"> 13 | <#Include Label="\^OperatorOnDigraphs"> 14 | <#Include Label="OnMultiDigraphs"> 15 | <#Include Label="OnTuplesDigraphs"> 16 |
17 | 18 |
19 | Isomorphisms and canonical labellings 20 | From version 0.11.0 of &Digraphs; it is possible to use either &BLISS; or 21 | &NAUTY; (via &NAUTYTRACESINTERFACE;) to calculate canonical labellings and 22 | automorphism groups of digraphs; see and for more details about &BLISS; and &NAUTY;, 24 | respectively. 25 | 26 | <#Include Label="DigraphsUseNauty"> 27 | <#Include Label="AutomorphismGroupDigraph"> 28 | <#Include Label="BlissAutomorphismGroup"> 29 | <#Include Label="NautyAutomorphismGroup"> 30 | <#Include Label="AutomorphismGroupDigraphColours"> 31 | <#Include Label="AutomorphismGroupDigraphEdgeColours"> 32 | <#Include Label="BlissCanonicalLabelling"> 33 | <#Include Label="BlissCanonicalLabellingColours"> 34 | <#Include Label="BlissCanonicalDigraph"> 35 | <#Include Label="DigraphGroup"> 36 | <#Include Label="DigraphOrbits"> 37 | <#Include Label="DigraphOrbitReps"> 38 | <#Include Label="DigraphSchreierVector"> 39 | <#Include Label="DigraphStabilizer"> 40 | <#Include Label="IsIsomorphicDigraph"> 41 | <#Include Label="IsIsomorphicDigraphColours"> 42 | <#Include Label="IsomorphismDigraphs"> 43 | <#Include Label="IsomorphismDigraphsColours"> 44 | <#Include Label="RepresentativeOutNeighbours"> 45 | <#Include Label="IsDigraphAutomorphism"> 46 | <#Include Label="IsDigraphColouring"> 47 | <#Include Label="MaximalCommonSubdigraph"> 48 | <#Include Label="MinimalCommonSuperdigraph"> 49 |
50 | 51 |
Homomorphisms of digraphs 52 | 53 | The following methods exist to find homomorphisms between digraphs. 54 | If an argument to one of these methods is a digraph with multiple edges, 55 | then the multiplicity of edges will be ignored in order to perform the 56 | calculation; the digraph will be treated as if it has no multiple edges. 57 | 58 | <#Include Label="HomomorphismDigraphsFinder"> 59 | <#Include Label="DigraphHomomorphism"> 60 | <#Include Label="HomomorphismsDigraphs"> 61 | <#Include Label="DigraphMonomorphism"> 62 | <#Include Label="MonomorphismsDigraphs"> 63 | <#Include Label="DigraphEpimorphism"> 64 | <#Include Label="EpimorphismsDigraphs"> 65 | <#Include Label="DigraphEmbedding"> 66 | <#Include Label="EmbeddingsDigraphs"> 67 | <#Include Label="IsDigraphHomomorphism"> 68 | <#Include Label="IsDigraphEmbedding"> 69 | <#Include Label="SubdigraphsMonomorphisms"> 70 | <#Include Label="DigraphsRespectsColouring"> 71 | <#Include Label="GeneratorsOfEndomorphismMonoid"> 72 | <#Include Label="DigraphColouring"> 73 | <#Include Label="DigraphGreedyColouring"> 74 | <#Include Label="DigraphWelshPowellOrder"> 75 | <#Include Label="ChromaticNumber"> 76 | <#Include Label="DigraphCore"> 77 | <#Include Label="LatticeDigraphEmbedding"> 78 | <#Include Label="IsLatticeHomomorphism"> 79 |
80 | 81 | 82 | --------------------------------------------------------------------------------