======The much needed explanation of the code====

Im sorry for the delay but here it is, and hope Im clear enough.

Consider the input file:
Eve,BigDaddy,Father John,Eve,Son John,Chang,Son Chang,Eve,Mother
So in this case consider the first column,we have 3 children : Eve, John, Chang.

The third column is the relation of second column to first column.

For each of them we need to find their shortest link to the BigDaddy(or "Q" as I have shown in the sample input file. "Q" is the BigDaddy in the sample input case. So for Eve we already have the shortest path to BigDaddy which is

Eve :    Eve<-BigDaddy,  Father , Male_relations_1

While for John, John is related to eve as (Son) and Eve is BigDaddy as (Father). Thus the third column will have their relationships concatenated :

John:    John<-Eve<-BigDaddy, Son.Father , Male_relations_5

The fourth column is the Relation id for these concatenated relations. These sets of relation ids will already be given (as you can see in the code its inside the hash %DEF). Eg

DEF = ( Male_relations => [qw(Father Father.Son Son Brother Son.Father +.....)], Female_relations => [qw(Mother Mother.Son Aunt Aunt.Father ....)])

The concatenated relation between John and BigDaddy is Son.Father, which is number 5 in the Male_relations, hence we denote Male_relations_5


In reply to Re^2: Perl code for finding shortest path not working on large files (chomp) by zing
in thread Perl code for finding shortest path not working on large files by zing

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.