示例#1
0
        /// <summary>
        /// 删除以结点为出发点的边
        /// <list type="Bullet">
        /// <item>
        /// 删除每个结点
        /// </item>
        /// <item>
        /// 修改结点的相关结点的入度
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="index"></param>
        private void RemoveSource(int index)
        {
            VertexEx <TV, TE, TW>    vertex = _list[index];
            IList <EdgeEx <TE, TW> > edge   = vertex.Edges;

            edge.Foreach(RemoveSource);
            _list.Remove(index);
        }
示例#2
0
        private void RemoveDestination(VertexEx <TV, TE, TW> vertex, int index)
        {
            var edge = vertex.Edges;

            for (int i = 0; i < edge.Size;)
            {
                if (edge[i].Destination > index)
                {
                    edge[i].Destination--;
                    i++;
                    continue;
                }
                if (edge[i].Destination == index)
                {
                    E--;
                    edge.Remove(i);
                }
                else
                {
                    i++;
                }
            }
        }