- #1
mignoncharly
- 4
- 0
Hi evryone,
i have started to write an "algorithm" that finds the Family of a given element in a table of 3 columns: Id, Source and Destination. When i say Family i mean each element (i.e. A) from Source that has a relation with another one in Destination and i have to find a family for that new (element) one (coming from A) and so on till there is no sucessor more. May be it would be clear with what i have done so far? please don't be rude :) Thanks (Approach below)
i=0 J value (sucessor) of A : A->J
i=7 A -||- F : F->A
i=8 E -||- A : A->E
A->J F->A A->E store in BigArray()
//searching for the new Family of each tied value of A (J, F, E)
case1//if J exists in Source() and J = Source(j) <- A ignore
//if J found in Source() find sucessors
i=0 ignore
case2//if F exists in Source() and F = Source(j) <- A ignore
//if F found in Source() find sucessors
i=6 F value (sucessor) of Z : Z->F, Z->F store in BigArray()
i=7 ignore
//searching for the new Family of each tied value of F (Z)
case2.1// if Z exists in Source() and Z = Source(j) <- A ignore
//if Z found in Source() find sucessors
i=6 ignore
case3//if E exists in Source() and E = Source(j) <- A ignore
//if E found in Source() find sucessors
i=1 E value (sucessor) of B : B->E
i=2 Y -||- E : E->Y
i=3 Z -||- E : E->Z
i=8 ignore
B->E E->Y E->Z store in BigArray()
//searching for the new Family of each tied value of E (B,Y,Z)
case3.1// if B exists in Source() and B = Source(j) <- A ignore
//if B found in Source() find sucessors
i=1 ignore
i=4 B value(sucessor) of X : X->B, X->B store in BigArray()
case3.2// if Y exists in Source() and Y = Source(j) <- A ignore
//if Y found in Source() find sucessors
i=2 ignore
case3.3// if Z exists in Source() and Z = Source(j) <- A ignore
//if Z found in Source() find sucessors
i= 3 ignore
i=6 F value(sucessor) of Z: Z->F, Z->F store in BigArray()
//Looking now for duplication
BigArray=(A->J, F->A, A->E, Z->F, B->E, E->Y, E->Z, X->B, Z->F)
//if duplication exists, erase both
BigArray=(A->J, F->A, A->E, B->E, E->Y, E->Z, X->B)BigArray is the result i want to have at the end.
I can understand that some of you might not get what i have done so far but it was the best way for me to explain it like this. Thank you
(sorry english is not my first language :) )
Best Regards
Charly
i have started to write an "algorithm" that finds the Family of a given element in a table of 3 columns: Id, Source and Destination. When i say Family i mean each element (i.e. A) from Source that has a relation with another one in Destination and i have to find a family for that new (element) one (coming from A) and so on till there is no sucessor more. May be it would be clear with what i have done so far? please don't be rude :) Thanks (Approach below)
Code:
Array Source(), Destination(), BigArray() int
Variable i, j, k, N, found, pieceToFind int
Variable notFound boolean
//verify if pieceToFind exists in Source()
for i=0;i->N;i++
if pieceToFind != Source(j)
notFound <- true
else found <- pieceToFind
//looking for A sucessors or predecessors
for i=0; i->N; i++
for j=0; j->N; j++
for k=0; k->N; k++
//here i want to bind A with the element located in Destination at the same NodeId index (i=0, A has value J) and store it in a new Array X() and so on
while (found ... )
.
.
.
i=7 A -||- F : F->A
i=8 E -||- A : A->E
A->J F->A A->E store in BigArray()
//searching for the new Family of each tied value of A (J, F, E)
case1//if J exists in Source() and J = Source(j) <- A ignore
//if J found in Source() find sucessors
i=0 ignore
case2//if F exists in Source() and F = Source(j) <- A ignore
//if F found in Source() find sucessors
i=6 F value (sucessor) of Z : Z->F, Z->F store in BigArray()
i=7 ignore
//searching for the new Family of each tied value of F (Z)
case2.1// if Z exists in Source() and Z = Source(j) <- A ignore
//if Z found in Source() find sucessors
i=6 ignore
case3//if E exists in Source() and E = Source(j) <- A ignore
//if E found in Source() find sucessors
i=1 E value (sucessor) of B : B->E
i=2 Y -||- E : E->Y
i=3 Z -||- E : E->Z
i=8 ignore
B->E E->Y E->Z store in BigArray()
//searching for the new Family of each tied value of E (B,Y,Z)
case3.1// if B exists in Source() and B = Source(j) <- A ignore
//if B found in Source() find sucessors
i=1 ignore
i=4 B value(sucessor) of X : X->B, X->B store in BigArray()
case3.2// if Y exists in Source() and Y = Source(j) <- A ignore
//if Y found in Source() find sucessors
i=2 ignore
case3.3// if Z exists in Source() and Z = Source(j) <- A ignore
//if Z found in Source() find sucessors
i= 3 ignore
i=6 F value(sucessor) of Z: Z->F, Z->F store in BigArray()
//Looking now for duplication
BigArray=(A->J, F->A, A->E, Z->F, B->E, E->Y, E->Z, X->B, Z->F)
//if duplication exists, erase both
BigArray=(A->J, F->A, A->E, B->E, E->Y, E->Z, X->B)BigArray is the result i want to have at the end.
I can understand that some of you might not get what i have done so far but it was the best way for me to explain it like this. Thank you
(sorry english is not my first language :) )
Best Regards
Charly
Attachments
Last edited by a moderator: