A method of calculating a valley-free shortest path between two autonomous systems having a first graph representing an autonomous system topology and comprising a plurality of nodes and a plurality of links interconnecting the nodes, each link linking a first and a second node of the plurality of nodes. The method comprises generating a second graph using the first graph by: Mapping the nodes of the first graph into the second graph, by representing each node of the first graph by a respective uphill node and a downhill node; mapping each link of the first, second and third relationship type with a plurality of directed links between the uphill and downhill nodes according to the type of relationship. The method further comprises calculating the shortest-path route between two autonomous systems on the second graph, using the shortest-path routing algorithm.