Ask Your Question
0

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

asked 9 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 9 years ago

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.

Preview: (hide)
link

Comments

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

siki_math gravatar imagesiki_math ( 9 years ago )

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

graphs.nauty_geng?

In Sage.

Nathann gravatar imageNathann ( 9 years ago )

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 ( 9 years ago )

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

Stats

Asked: 9 years ago

Seen: 589 times

Last updated: Aug 25 '15