Skip to content

A (proof of concept) generator of functional digraphs up to isomorphism

License

Notifications You must be signed in to change notification settings

aeporreca/funkdigen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Warning

funkdigen, although efficient from an asymptotic point of view, is not efficient in terms of raw execution time, being rather a straightforward implementation in Python of the algorithms described in the the paper below. If you want real efficiency, as well as an output format compatible with established software, please use funkdigen2 instead! 🙂

funkdigen

An proof-of-concept generator of functional digraphs (uniform outdegree 1) up to isomorphism, also called mapping patterns, finite (endo)functions, or finite dynamical systems; see sequence A001372 on the OEIS. It is also possible to only generate connected functional digraphs (sequence A002861 on the OEIS).

Background

Based on Oscar Defrain, Antonio E. Porreca, Ekaterina Timofeeva, Polynomial-delay generation of functional digraphs up to isomorphism, Discrete Applied Mathematics 357, 24–33, 2024, https://doi.org/10.1016/j.dam.2024.05.030

Output format

The output format is described in the paper itself. To summarise, keeping in mind that each connected component of a functional digraph consists of directed trees (with arcs pointing towards the root) with roots arranged along a limit cycle:

  • Each functional digraph code is a list of the codes of its connected components in the lexicographic order induced by the algorithm for generating them.
  • Each connected functional digraph code is the lexicographically minimal rotation of the list of the codes of its trees.
  • The code of a tree $T$ is the list obtained by concatenating $[n]$ with $t_1, \ldots, t_k$, where $[n]$ is the singleton list containing the number $n$ of nodes of $T$, and $t_1, \ldots, t_k$ are the codes (computed recursively) of its immediate subtrees in lexicographic order.

Installation

Just download the code from the Releases page (or clone this repository if you want the latest changes). Python 3.9 is needed in order to run funkdigen.

Usage

usage: funkdigen.py [-h] [-c] [-q] [-V] size

Generate all functional digraphs up to isomorphism

positional arguments:
  size             number of vertices

options:
  -h, --help       show this help message and exit
  -c, --connected  only generate connected digraphs
  -q, --quiet      do not print the generated digraphs
  -V, --version    show program's version number and exit

Credits

The funkdigen software is copyright © 2024 by Oscar Defrain, Antonio E. Porreca and Ekaterina Timofeeva, and its source code is distributed under the GNU GPL 3.0 license. The development has been partly funded by the French ANR projet FANs ANR-18-CE40-0002 (Foundations of Automata Networks).