Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding an algorithm

Status
Not open for further replies.
Jul 29, 2005
136
PT
Hi,

Im trying to make a virtual connection (link) between n elements/objects.

For instance, if I have 3 objects, I would like to create, one by one (because I need do execute a test on each new link), this links (exploring all possible links):

objects: a b c (3 objects)

Link1: no link
Link2: abc
Link3: ab (bc with no link)
Link4: ac (ab and bc with no link)
Link5: bc
Link6: ab + ac (bc with no link)
Link7: ac + bc (ab with no link)
Link8: ab + bc + ac (all connected)

Total links: will be 8

I´m trying this using recursive function, but I´m not getting the best results.

Any help?

Thank you
 
Hi,

No. A link between a->b is the same between b->a

Thank you
 
I understand, what I meant to say is - does the order of Links matter (as in AB before BC before ABC). Also, why does your example not include AB + BC?
-Max
 
Hello again and thank you for your time,

Question 1:

No, I just need to teste all the possible links. That order doesn´t matter.


Question 2:

AB + BC it´s the same as ABC (A is connected to B, and B is connected with C) => Link 2

Thank you again.
 
I must be confused then, because doesn't that negate such combos as AB+AC, AC+AB, AB+BC+AC, since they all have connective elements making them all equal ABC?
-Max
 
This is more simple to understand if we draw 3 squares on paper.

For instance:

AB+AC is different from ABC, because

In the first situation, you don´t have a link between BC (a line connecting them).
In the second situation, you don´t have this link: AC

Am I being clear? Please tell me if Iám not.

Thank you
 
Hi again,

Note, however that : AB+AC it´s equal to AC+AB.
 
I'm sorry, you'll have to explain the three squares again. Where did you get the problem? Is this something I can find online?
-Max
 
ok,

I have n objects (suppose 3). I need to test all possible links that can be created between this objects:

Combination 3 by 3 = 1
combinations 3 by 2 = 3
combinations 3 by 1 = 3
combinations 3 by 0 = 1 (when there is no links created)

The total for this example, I think will be 8 possible combinations, those I refered in the first post.

link1: no link (a, b and c isolated)
link2: a-b-c ( a is linked with b and b is linked with c)
link3: a-b (a linked with b. The same as b linked with a)
link4: a-c (a linked with c)
Link5: b-c (b linked with c)
Link6: a-b + a-c (a linked with b AND a linked with c at the same time)
Link7: ac + bc (a linked with c AND b linked with c. Please not, for instance, that in this combination "a" is not directly linked with "b")
Link8: ab + bc + ac (a is linked with b AND b is linked with c AND a is linked with c. So, they are all connected)

Note that the link between objects is bidireccional. So, a-b is the same of having b-a.

I need do teste all this different combination, because I need to get an output value of them.

This is for a multi-structered regression analyse (using AMOS). There is no example on the net.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top