Welcome to the Monastery | |
PerlMonks |
Formalizing an array type problem, looking for solutionby melmoth (Acolyte) |
on Sep 01, 2016 at 00:08 UTC ( [id://1170935]=perlquestion: print w/replies, xml ) | Need Help?? |
melmoth has asked for the wisdom of the Perl Monks concerning the following question: An array of hashes, each hash containing one path, its ID, and its order ( foreward (F) or reverse (R) ) each path is initialized in the F position
each node or vertex of each path also has an orientation ( + or - )
You can reverse the order of a path ( e.g., A, B to B, A ) When you reverse order from F => R or R => F you also switch the orientation of each node in the path from + to - or - to + The paths with orientations look like this: 1 .A+ : B+ 2. C+ : D- : E- 3. E- : B- this is the problem input for output, i'd like to know whether or not it is possible by reverseing path orders to create a consensus path and also what is the way to do this such that you are guaranteed to find the consensus path for example, if we reversed path 1 we'd get: 1. B- : A- 2. C+ : D- : E- 3. E- : B- and the resulting consensus path would be: C+ : D- : E- : B- : A- but it's not clear to reverse path 1 first; for example; what if started by reversing path 3? So you can't proceed randomly. Does anyone recognize this problem? Does it have a solution? Thanks.
Back to
Seekers of Perl Wisdom
|
|