private string CalculateShortestPath(char sourceNode, char destinationNode) { AbstractGraphPath <char> shortestPath = ShortestPathCalulator.GetShortestPath(_graph, sourceNode, destinationNode); string result = shortestPath == null ? "NO SUCH ROUTE" : shortestPath.PathWeight.ToString(); return(result); }
private void FillPredecessor(AbstractGraphPath <TNode> graphPath, TNode node) { TNode predecessor; if (_predessorNodes.TryGetValue(node, out predecessor)) { graphPath.Path.Insert(0, predecessor); FillPredecessor(graphPath, predecessor); } }
public override int CompareTo(AbstractGraphPath <TNode> other) { if (PathWeight == other.PathWeight) { return(0); } if (PathWeight == InfinityValue) { return(1); } if (other.PathWeight == InfinityValue) { return(-1); } if (PathWeight > other.PathWeight) { return(1); } return(-1); }