Пример #1
0
        public virtual void RemoveEdge(IEdge edge)
        {
            GraphContract.ValidateRemoveEdge(edge);

            var   outVertex = (TinkerVertex)edge.GetVertex(Direction.Out);
            var   inVertex  = (TinkerVertex)edge.GetVertex(Direction.In);
            IEdge removedEdge;

            if (null != outVertex && null != outVertex.OutEdges)
            {
                var e = outVertex.OutEdges.Get(edge.Label);
                if (null != e)
                {
                    e.TryRemove(edge.Id.ToString(), out removedEdge);
                }
            }
            if (null != inVertex && null != inVertex.InEdges)
            {
                var e = inVertex.InEdges.Get(edge.Label);
                if (null != e)
                {
                    e.TryRemove(edge.Id.ToString(), out removedEdge);
                }
            }


            EdgeKeyIndex.RemoveElement(edge);
            foreach (var idx in GetIndices().Where(t => t.Type == typeof(IEdge)).Cast <TinkerIndex>())
            {
                idx.RemoveElement(edge);
            }

            Edges.TryRemove(edge.Id.ToString(), out removedEdge);
        }