/* This program demonstrates how an isomorphism is found between twographs,usingtheMoebiusgraphasanexample. ThisversionusesTracesanddemonstrateshowtocomputethe automorphismgroupseparatelybeforecomputingthecanonical labelling.Althoughthisisslowerforeasygraphslike thosehere,itcanbefasterforsomeverydifficultgraphs.
*/
/* Now we make the canonically labelled graphs by a two-step process.ThefirstcalltoTracescomputesthe automorphismgroup.Thesecondcallcomputesthe canonicallabelling,usingtheautomorphismgroupfrom thefirstcall.
Wehavedeclaredavariable"generators"thatwillbe usedtoholdthegroupgeneratorsbetweenthetwocalls. IthastobeinitialisedtoNULLanditsaddresshasto begiventoTracesusingoptions.generators.Afterthe secondcall,weneedtodiscardthegeneratorswitha
call to freeschreier(), which also initializes it again. */
if (aresame_sg(&cg1,&cg2))
{
printf("Isomorphic.\n"); if (n <= 1000)
{ /* Write the isomorphism. For each i, vertex lab1[i] ofsg1mapsontovertexlab2[i]ofsg2.Wecompute
the map in order of labelling because it looks better. */
for (i = 0; i < n; ++i) map[lab1[i]] = lab2[i]; for (i = 0; i < n; ++i) printf(" %d-%d",i,map[i]);
printf("\n");
}
} else
printf("Not isomorphic.\n");
} else break;
}
exit(0);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.