Ask Your Question

How do I generate list of connected graphs with given number of vertices?

asked 2015-08-25 00:07:30 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I have used this short nauty program to generate graphs with given number of vertices, edges and degree information. c =0 for G in graphs . nauty_geng (’9 12 -d4D4 ’) : c = c +1 print " graph "+str( c ) +" ( graph6 string ’"+ G . graph6_string () +" ’):" G . adjacency_matrix () G . show () print "" print ""

It generates a list of all graph with given information. My query is that How do I filter them to get only connected ones?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-08-25 02:20:31 -0500

Nathann gravatar image

If you read the documentation of nauty_geng, you will see that it has a '-c' flag to do exactly what you want.

edit flag offensive delete link more


Could you please share that document with me? Or any link where I could find that.?

siki_math gravatar imagesiki_math ( 2015-08-26 23:56:03 -0500 )edit

By "document" are you refering to the documentation of nauty_geng? If so, know that you can get the doc of any Sage function with a question mark. In the present case, just type


In Sage.

Nathann gravatar imageNathann ( 2015-08-27 05:42:14 -0500 )edit

Yes, I meant the documentation of nauty-geng. I got you now. Thank you very much for your assistance Nathann..:)

siki_math gravatar imagesiki_math ( 2015-09-03 21:31:31 -0500 )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: 2015-08-25 00:07:30 -0500

Seen: 139 times

Last updated: Aug 25 '15