Can anybody help me in generating an elementary set E.
Notations:
m = no. of edges
Elementary set consists of 2^m no. of elements
The Elementary set should look like,
{1}, {2}, {3}, ..., {1,2}, {1,3}, {1,4},{1,5},{2,3} ...., {1,2,3,4,5}
This example I have shown it for m = 5
I want to write the code in C
I would be very much grateful, if anybody could provide me with the source code.
mehdi62b
October 22nd, 2004, 03:28 PM
Hi santosh311,
its better to solve it yourself,not looking for the code,
you can do it like the the following way,
consider 1,2,3,4,5 now(for m=5)
just generate binary numbers from 0(00000) to 31(111111)
then for example
so you generate all subsets in this way according to the binary numbers
Hope I gave you the idea ....
santosh311
October 22nd, 2004, 08:01 PM
hi,
Thanks for the reply.
But in my code it is not restricted to just m=5, it could be anything. I will give you the idea of how the entire set should look like.
For example if m = 5
If you can just tell me the logical part as to how to get the sequence i would be grateful. I can try to code it once I get the logic.
Thanks in advance
With regards
mehdi62b
October 23rd, 2004, 12:56 PM
I know it is not restricted to 5,
I just gave you the example for m=5
you should generate the numbers from 0 to 2^m-1(in binary)
i.e for m=3,
from 0(000) to 7(111)