I have a tree structure of interconnected nodes of various types. Each node keeps track of which nodes it is connected to. In this structure I need to find the longest unconnected chain or path of same type nodes.
I've read up on graphs and breadth/depth first searches but these don't quite yield the results I need. (they'll find a chain but also include all the dead end branches between an origin and destination node)
Is there an existing algorithm for this purpose?