Exemplo n.º 1
0
 private static void Task_ProcessPair(
     ExplorationNode source,
     ExplorationNode dest)
 {
     IList<ExplorationEdge> edges =
         ParallelGraphUtil.AStarPath(source, dest);
     if (edges != null)
         source.SetPathOut(dest.Id, edges.ToArray());
 }
Exemplo n.º 2
0
    private static void AssignEdgesToNode(
        Dictionary<uint, ExplorationEdge> idToEdge,
        NodeData data,
        ExplorationNode node)
    {
        // Add the incoming and outgoing nodes, in order
        foreach (uint id in data.Incoming)
            node.AddIncoming(idToEdge[id]);
        foreach (uint id in data.Outgoing)
            node.AddOutgoing(idToEdge[id]);

        List<ExplorationEdge> edges = new List<ExplorationEdge>();
        // Convert the path to path edges for each target
        for (int tIdx = 0; tIdx < data.Paths.Length; tIdx++)
        {
            uint[] pathIds = data.Paths[tIdx];
            ExplorationEdge[] pathEdges =
                pathIds.Convert((id) => idToEdge[id]).ToArray();
            ExplorationNode target = pathEdges.Last().Target;
            node.SetPathOut(target.Id, pathEdges);
        }
    }