1 Replies - 650 Views - Last Post: 06 June 2012 - 10:29 PM Rate Topic: ***-- 2 Votes

#1 ellenwindsor199   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-June 12

A graph with n vertexes- how to print all possible graph combinations

Posted 06 June 2012 - 10:03 PM

Suppose that we set the number of vertexes in a graph as n. (we can set this by user inputs etc.)

I'd like to print all possible cases of connecting vertexes using edges. (So, I'd like to print all possible (simple) connected graphs of n vertexes.)

Also, for each case, I'd like to print degree of each vertex in each case.
Is This A Good Question/Topic? 0
  • +

Replies To: A graph with n vertexes- how to print all possible graph combinations

#2 Salem_c   User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2237
  • View blog
  • Posts: 4,322
  • Joined: 30-May 10

Re: A graph with n vertexes- how to print all possible graph combinations

Posted 06 June 2012 - 10:29 PM

So start with a piece of paper and a pencil and start drawing lots of simple graphs based on increasing numbers of points. I guess 1 and 2 points are very simple, as perhaps 3 points might be.

Maybe you can spot a relationship between generating graphs for N points and generating a single instance of graphs for N-1 points.

When you understand how it works on paper, then you can try writing some code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1