I am doing a program in C on graph theory. So I need an idea with which i can generate random graphs which are mostly highly disconnected. Can anyone give me any idea please?
This is a discussion on Generate Disconnected Graph in C within the C Programming forums, part of the General Programming Boards category; I am doing a program in C on graph theory. So I need an idea with which i can generate ...
I am doing a program in C on graph theory. So I need an idea with which i can generate random graphs which are mostly highly disconnected. Can anyone give me any idea please?
Create N nodes and log2(N) paths between random pairs of nodes.
Eg, if N = 256, then log2(N) will be 8 (that's going to be pretty well disconnected).
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Oh thanks! Nice idea let me try! Will ask here if I get struck! Thanks a lot!
Create N nodes and 0 edges. That's the most disconnected you can get.