This work is a study of the implementation found at nauty package that uses canonical labeling to identify isomorphic graphs.
The work consists in:
Gerador de entradas conforme descrito em python;- Um algoritmo que determina se dois grafos são isomorfos utilizando a técnica de força bruta (em
PythonC) Caso haja tempo, uma transcrição do algoritmo de McKay para python 3;Caso haja tempo, uma pequena introdução ao algoritmo quasi-polinomial de Babai (BABAI, 2016) (BABAI, 2017).generate graphs using geng (nauty);convert the graphs to a human readable format, using showg (nauty);format the graph to the format used by brute;- run the generate inputs in brute
- run the generate inputs in dreadnaut (nauty)
- automate test executions with shell script for brute and TCL/expect for nauty
- compare the results
- Nauty evaluation
For brute, two lines must be given as input, each line describes a graph. The input format follows these rules:
- Vertex adjacencies are represented as a sequence of numbers separated by spaces
- Vertices adjacencies are divided by semicolon (;) and given in order
- A dot (.) represents the end of the input for the graph.
That structure was chosen due the input format used by dreadnaut program from nauty package.
An example of input for a 6 vertices graph:
1 3 5; 0 2; 1; 5; 2; 1.
4 2; 1 3 5; 5; 2; 1; 0.
Sources: nug26.pdf (nauty)
- automorphism: An automorphism of a graph is a permutation of the vertex labels so that the set of edges remains the same;
- equivalence: Two vertices are equivalent if there is an automorphism taking one to the other;
- orbits: A set of equivalent vertices;
- canonical labelling: This is an operation of placing the vertex labels in a way that does not depend on where they were before;
- isomorphic graphs: Two graphs are isomorphic when their canonized
- representation are the same.
Nauty applies canonical labelling to determine isomorphic graphs.
- dreadnaut is very difficult for scripting
- Convert from graph formats isn't done through one single tool (showg)
- geng doesn't allow to tell how many graphs we want, it produces all of them!
- geng drove me to 'disk full' producing +14GB of 13 vertices graphs
- Source code isn't that good to understand (bad indentation, huge functions..)
- Very fast
- Nice documentation (pdf) provided among the package
The experiments consisted of running 10 instances each composed of two isomorphic graphs both in brute and nauty.
- As expected, the experiments with brute took a lot of time with 13 nodes (~6 min)
- Nauty took 0 seconds for the same inputs used in brute
- Automated infra-structure to perform benchmarking
- Skeleton code in C to implement isomorphism checking algorithms
- Simple graph generator that takes the desired number of graphs as argument (learn this geng!)
- Scripts that can be used as reference to further tasks automations
There's lots to do.. =/
For now some restrictions applies due the simpler implementation we have so far.
- Maximum of N vertices (
1 < N < 13) vertices for each graph - The v vertices must be named with numbers
0 <= v < N
Vertices are a list of numbers 0
Vertices adjacencies are determined by a
A list of adjacent vertices where all numbers Each graph must be define on a single line as a CSV entry