Here is a graph: g = RandomGraph[{20, 50}]; Here is the path between $\nu_l = 5$ and $\nu_n = 9$ (chosen arbitrarily): mypathlist = FindPath[g, 5, 9][[1]] (* {5, 2, 3, 6, 4, 1, 18, 10, 7, 9} *) Here are two points along that path chosen arbitrarily: myvertexes = RandomSample[mypathlist, 2] (* {2, 7} *) Here is the shortest path in $g$ between these vertexes: mynewpathsegment = FindShortestPath[g, myvertexes[[1]], myvertexes[[2]]] (* {2,7} *) Here is the original path with the new shortest path replacing the existing path segment: mypathlist /. {x__, PatternSequence[myvertexes[[1]], __, myvertexes[[2]]], z__} -> {x, Sequence[myvertexes[[1]], myvertexes[[2]]], z} (* {5, 2, 7, 9} *)