示例#1
0
        protected void buildGuidMap(MoronThinker thinker)
        {
            List <MoronIONode> visited, horizon;
            MoronIONode        node;

            horizon = new List <MoronIONode>();
            visited = new List <MoronIONode>();

            horizon.Add(thinker.getCurrentNode());
            guidMap = new Dictionary <String, MoronIONode>();

            while (horizon.Count > 0)
            {
                node = horizon[0];
                horizon.RemoveAt(0);
                visited.Add(node);

                guidMap[node.guid] = node;

                foreach (GraphEdge edge in node.edges)
                {
                    if (!visited.Contains((MoronIONode)edge.to))
                    {
                        horizon.Add((MoronIONode)edge.to);
                    }
                }
            }
        }