Ask Your Question

Working with unlabelled graphs

asked 2021-09-14 11:50:29 +0200

oldani gravatar image

I'm studying certain properties of graphs but I want to work with unlabelled ones i.e. I do not want to distinguish graphs that differs only by the numbering of vertices, which is the case by default if I have correctly understood. Is it possible?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-09-14 22:41:07 +0200

Max Alekseyev gravatar image

updated 2021-09-15 14:56:16 +0200

It's unclear what do you mean under "distinguish". If it's about creation/generation of unlabeled graphs, then many graph construction methods produce unlabeled (di)graphs. If it's about comparison of unlabeled graphs, then this can be done via comparison of their canonical labels (.canonical_label()). So, example of what you want to achieve would be helpful.

edit flag offensive delete link more

answered 2021-09-14 21:06:53 +0200

slelievre gravatar image

Nauty has a generator of graphs up to isomorphism.

Sage has an interface to it.

See the nauty_geng function:

edit flag offensive delete link more


Graphs have the method is_isomorphic : G1.is_isomorphic(G2) is True if G2 is a relabelling of G1. I am not aware of a built-in way to designate the equivalence classes thus defined :however, my knowledge of (this part of) Sage is quite superficial.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-09-14 22:50:52 +0200 )edit

Canonical representatives of the equivalence classes are produced by .canonical_label().

Max Alekseyev gravatar imageMax Alekseyev ( 2021-09-14 23:23:45 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2021-09-14 11:50:29 +0200

Seen: 43 times

Last updated: Sep 15