public TransitLeastCostPathTree(final Network network, final TransitTravelDisutility costFunction, final TravelTime timeFunction, final Map<Node, InitialNode> fromNodes, final Map<Node, InitialNode> toNodes, final Person person) { this.network = network; this.costFunction = costFunction; this.timeFunction = timeFunction; this.nodeData = new HashMap<>((int)(network.getNodes().size() * 1.1), 0.95f); //create tree this.resetNetworkVisited(); this.person = person; this.customDataManager.reset(); this.fromNodes = fromNodes; pendingNodes = (RouterPriorityQueue<Node>) createRouterPriorityQueue(); for (Map.Entry<Node, InitialNode> entry : fromNodes.entrySet()) { DijkstraNodeData data = getData(entry.getKey()); visitNode(entry.getKey(), data, pendingNodes, entry.getValue().initialTime, entry.getValue().initialCost, null); } expandNodeData(toNodes); }
public TransitLeastCostPathTree(final Network network, final TransitTravelDisutility costFunction, final TravelTime timeFunction, final Map<Node, InitialNode> fromNodes, final Person person) { this.network = network; this.costFunction = costFunction; this.timeFunction = timeFunction; this.nodeData = new HashMap<>((int)(network.getNodes().size() * 1.1), 0.95f); //create tree this.resetNetworkVisited(); this.person = person; this.customDataManager.reset(); this.fromNodes = fromNodes; pendingNodes = (RouterPriorityQueue<Node>) createRouterPriorityQueue(); for (Map.Entry<Node, InitialNode> entry : fromNodes.entrySet()) { DijkstraNodeData data = getData(entry.getKey()); visitNode(entry.getKey(), data, pendingNodes, entry.getValue().initialTime, entry.getValue().initialCost, null); } // do the real work while (pendingNodes.size() > 0) { Node outNode = pendingNodes.poll(); relaxNode(outNode, pendingNodes); } }