Ask Your Question

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

asked 2015-08-25 07:07:30 +0200

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 09:20:31 +0200

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-27 06:56:03 +0200 )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 12:42:14 +0200 )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-04 04:31:31 +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: 2015-08-25 07:07:30 +0200

Seen: 515 times

Last updated: Aug 25 '15