/// <inheritdoc/> public int[][] GetToPaths(int n) { int[][] paths = parent.GetToPaths(n); int i = parentObject.distTo[v]; // for all paths from the parent set the vertex at the given index foreach (int[] path in paths) { path[i] = v; } return(paths); }
/// <inheritdoc/> public int[][] GetToPaths(int n) { // get all shortest paths from the left and right int[][] leftPaths = left.GetToPaths(n); int[][] rightPaths = right.GetToPaths(n); // expand the left paths to a capacity which can also accommodate the right paths int[][] paths = new int[leftPaths.Length + rightPaths.Length][]; Array.Copy(leftPaths, paths, leftPaths.Length); // copy the right paths in to the expanded left paths Array.Copy(rightPaths, 0, paths, leftPaths.Length, rightPaths.Length); return(paths); }