Question: Distance between vertex and edge

 

What I mean by shortest distance between vertex and edge is

 

In the above petersen graph consider the vertex say 1 it's distance to

(1,6) will be 0 as 1 is part of the same edge

((1,2) will be 0 again

(1,5) it will zero again

(5,8) will be 1 that is (1,5)-(5,8)

(8,9) it will be 2 that is (1,5)-(5,8)-(8,9)

(5,4) it will be 1 that is (1,5)-(5,4)

(9,10) it will be 2 (1,5)-(5,4)-(9,10)

Etc for all edges the graph from a given vertex v given a Graph G

The order in which the edges are chosen to find the distances should be maintained so that each index in the list correspond to distance of that vertex from the same edge in different vertex lists in a order 

Kind help I apologize to take your time 

In output I need a list say T=[0, 0,1,2,..]

Please Wait...