This is a generic algorithm for fabricating the longest links from misordered from-to pair input. Visitor pattern, gcc precompiled header and template explicit instantiation are demonstrated as well.