Ask Your Question

graphs of order n

asked 2019-08-03 15:13:02 +0200

GA316 gravatar image

How to generate all the graphs of particular order $n$ in sage?

is it possible to do the same up to isomorphism at least for small $n$?

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-03 22:56:02 +0200

slelievre gravatar image

The documentation is at

and especially

In particular the following generators exist:

sage: graphs(5)
<generator object GraphGenerators.__call__ at 0x...>
sage: graphs.nauty_geng("5")
<generator object GraphGenerators.nauty_geng at 0x...>
sage: graphs.nauty_geng("5 -c")
<generator object GraphGenerators.nauty_geng at 0x...>

and there are many more options to nauty's geng.

edit flag offensive delete link more


Thank you. one doubt. graphs(5) gives the list of graphs up to isomorphism?

GA316 gravatar imageGA316 ( 2019-08-04 08:32:11 +0200 )edit

The documentation can be accessed with ?:

sage: graphs?

and it says this generator produces one representative for each isomorphism class.

To get "all graphs", run through all subsets of the set of unordered pairs of integers among the first n integers and construct the corresponding graphs.

slelievre gravatar imageslelievre ( 2019-08-04 13:02:19 +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

1 follower


Asked: 2019-08-03 15:13:02 +0200

Seen: 432 times

Last updated: Aug 03 '19