public void PermuteTest(SimpleGraph graph)
        {
            Console.Out.WriteLine(Arrays.ToJavaString(GetLabels(graph)) + " " + graph);
            SimpleGraphPermutor permutor = new SimpleGraphPermutor(graph);
            var relabelledStrings        = new HashSet <string>();

            // permute, and relabel
            foreach (var permutation in permutor)
            {
                int[]       labels     = GetLabels(permutation);
                SimpleGraph relabelled = new SimpleGraph(permutation, labels);
                bool        isIdentity = IsIdentity(labels);
                Console.Out.WriteLine(
                    Arrays.ToJavaString(labels) + " " + permutation + " " + relabelled
                    + " " + isIdentity);
                relabelledStrings.Add(relabelled.ToString());
            }
            Assert.AreEqual(1, relabelledStrings.Count);

            // list the number of unique strings
            var values = relabelledStrings.GetEnumerator();

            for (int i = 0; i < relabelledStrings.Count; i++)
            {
                values.MoveNext();
                Console.Out.WriteLine(i + " " + values.Current);
            }
        }
Beispiel #2
0
        // XXX DOES NOT YET WORK - reconstructed graph may be isomorphic,
        // but not automorphic
        public void Reconstruct(SimpleGraph graph)
        {
            SimpleGraphSignature signature = new SimpleGraphSignature(graph);

            foreach (var symmetryClass in signature.GetSymmetryClasses())
            {
                string             signatureString = symmetryClass.GetSignatureString();
                ColoredTree        tree            = AbstractVertexSignature.Parse(signatureString);
                SimpleGraphBuilder builder         = new SimpleGraphBuilder();
                SimpleGraph        reconstruction  = builder.FromTree(tree);
                Assert.AreEqual(reconstruction.ToString(), graph.ToString());
            }
        }