adapted the graph to the Skiena's conventions (the first node in the graph is not 0 but 1)