Page 1 of 1

Problems for transitive data

Posted: Fri Feb 06, 2004 11:03 am
by auvray.muriel
Hello,

I must find smallest of the identifiers while passing by different the connections (it is the history of the grandmother, the mother, the girl). But I do not know how much there are levels.

The awaited result is:
The grandmother has a relation with the mother
The mother has a relation with the girl
The grandmother has a relation with the girl
The girl has a relation with girl

Example of provided data
KEY_ID;ID_LIEE
1;2
3;1
4;5
6;5
8;8
0;3

The awaited result is:
1;0
3;0
4,4
5;4
6;4
8;8
0;0

Thank you for your help

Muriel

Posted: Fri Feb 06, 2004 11:29 am
by kcbland
I like to think I'm a pretty bright guy. But for the life of me, I cannot figure out what it is you are asking. I could make some guesses probably close to the mark, but you you please restate your problem? Could you also provide better examples, as KEY_ID and ID_LIEE does not tell us what those columns mean. Furthermore, the result table has no column names, so we'd be guessing as to the functional derivation.

Posted: Fri Feb 06, 2004 11:43 am
by kduke
Ken

Let me take a guess. This is like a bill of materials. Each part can be made up of other parts which can be made up of even more parts. I think we have covered this before. I am not sure if we ever received an answer that I liked. I think this is a multiple pass problem sort of like a bubble sort if you can remember that far back. I think you need to find the highest level first then build down from there. The highest level in a manufactured part is a single part like a nut or bolt. In this case I would create a hash file and see how many things have a relationship with an person then sort by this level or number of relationships. So aggregate on the number of hits or relationships you have.

1. So I think you need a hash file of all the keys.
2. Next a hash file of all the combinations like 1:0. Both fields need to be key fields. I would make the smallest key first or sort the keys which might be tricky.
3. Next count how many 1's you have or aggregate the counts.
4. Sort by the aggregated total.

Let me know if this works or how you solved this.

Posted: Fri Feb 06, 2004 11:58 am
by kcbland
Have at it Kim. My brain is pickled. I've had the flu for the last week so I can't think straight. I figured this is a hierarchical walk, like a WO-BOM, but the output specified is ambiguous. If the desired result is a flattened hierarchy, then yes, the approach is to find either the lowest level without dependents or the highest level without superiors, then walk the hierarchy in the appropriate direction from there.

Posted: Sat Feb 07, 2004 6:01 am
by auvray.muriel
I finally directed my development differently.

1 - I seek the number max by identifier
2 - The number max is stored in a file
3 - In a job control, I read the file which contains the value max, and thus I make turn the job time as many as the number max stored in the file.

It goes very well.

Thank you with all


For information, I had opened a file for a problem of loop associated with my problem :
viewtopic.php?p=102245&sid=4d175c4d0f6e ... d80#102245