コード例 #1
0
        public void Add(Region region, Region parent, int distance, Edge edge)
        {
            distance = tree[parent].DistanceToOrigin + distance;
            if (tree.ContainsKey(region))
            {
                RouteTreeNode node = tree[region];

                if (node.DistanceToOrigin > distance)
                {
                    node.DistanceToOrigin = distance;
                    node.Parent           = parent;
                    node.edge             = edge;
                    edge.color            = Color.DarkRed;
                }
            }
            else
            {
                RouteTreeNode node = new RouteTreeNode();
                node.DistanceToOrigin = distance;
                node.Parent           = parent;
                node.edge             = edge;
                edge.color            = Color.Red;
                tree.Add(region, node);
            }
        }
コード例 #2
0
        public void AddFirst(Region region)
        {
            RouteTreeNode node = new RouteTreeNode();

            node.DistanceToOrigin = 0;
            node.Parent           = null;
            node.edge             = null;
            tree.Add(region, node);
        }