In "Find an Eulerian cycle in a graph1" we defined an Eulerian cycle. A path that traverses each edge of a graph exactly once (but does not necessarily return to its starting node) is called an Eulerian path.

Assignment

Write a function eulerian_path that takes the location of a text file containing the description of an directed graph $$\mathcal{G}$$ that contains an Eulerian path, where the graph is given in the form of an adjacency list. Each line of the file contains the label (an integer) of a starting node, a space, the characters ->, another space and a comma-separated list containing the lexicographically sorted labels (integers) of all ending nodes connected to that starting node. The function must return an Eulerian path in $$\mathcal{G}$$, represented as a tuple of node labels.

Example

In the following interactive session, we assume the text file data01.txt2 to be located in the current directory.

>>> eulerian_path('data01.txt')
(6, 7, 8, 9, 6, 3, 0, 2, 1, 3, 4)