How can I order a list of connections
问题 I currently have a list of connections stored in a list where each connection is a directed link that connects two points and no point ever links to more than one point or is linked to by more than one point. For example: connections = [ (3, 7), (6, 5), (4, 6), (5, 3), (7, 8), (1, 2), (2, 1) ] Should produce: ordered = [ [ 4, 6, 5, 3, 7, 8 ], [ 1, 2, 1 ] ] I have attempt to do this using an algorithm that takes an input point and a list of connections and recursively calls itself to find the