Question: Longest distance in a graph via maple code

Here in the above graph we are trying to find the longest distance between two vertices For example now say we consider vertices v_2 and v_4 in the above graph 

P_1 , P_2 ,P_3 are different possible path length in the above graph between v_2 and v_4  and it can be seen now the longest distance is 3 as it is the greatest among all lengths between v_2 and v_4

 

AllPathshortest only does the shortest path

 

can anyone help in the in general  finding the longest path between two vertices a graph if i give the

graph and the two vertices it should longest distance

here between v_2 and v_4 longest or greatest distance is 3 which should  greatest length of the several different paths between v_ 2 and v_4 itself

it should display that value.

kind help if anyone can

Please Wait...