public void AddPredecessor(IReactiveNode node) { ValidatePredecessor(node); if (Predecessors.Contains(node) == false) { Predecessors.Add(node); } }
private void FindShortestDistance(Node node) { var adjNodes = GetNeighbors(node); foreach (var target in adjNodes) { if (GetShortestDistance(target) > GetShortestDistance(node) + GetDistance(node, target)) { Distance.Add(target, GetShortestDistance(node) + GetDistance(node, target)); Predecessors.Add(target, node); UnSettledNodes.Add(target); } } }