public ShortestPath[] CalculateShortestPaths(int sourceNodeId, int[] sinkNodeIds, bool measureExecutionTime = false) { Node source = FindNodeInGraph(sourceNodeId); //calc if needed TryCalculateShortestPaths(source, measureExecutionTime); //construct results ShortestPath[] paths = new ShortestPath[sinkNodeIds.Length]; if (measureExecutionTime) { _timer.Restart(); for (int i = 0; i < sinkNodeIds.Length; i++) { paths[i] = ConstructPath(sinkNodeIds[i]); } _timer.Stop(); _stats.WritingTimeInMilSec += _timer.ElapsedMilliseconds; } else { for (int i = 0; i < sinkNodeIds.Length; i++) { paths[i] = ConstructPath(sinkNodeIds[i]); } } return(paths); }
/// <summary> /// Returns Path and length as string /// </summary> public static string PrintPath(ShortestPath path) { return(path.ToString()); }