Beispiel #1
0
        public virtual IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            var idString = id.ToString();

            return(InnerVertices.Get(idString));
        }
Beispiel #2
0
        public IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            var vertex = BaseGraph.GetVertex(id);

            return(null == vertex ? null : new EventVertex(vertex, this));
        }
Beispiel #3
0
        public IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            if (null == id)
            {
                throw new ArgumentNullException("id");
            }

            if (_supportVertexIds)
            {
                var i    = _baseGraph.GetVertices(Id, id);
                var iter = i.GetEnumerator();
                if (!iter.MoveNext())
                {
                    return(null);
                }
                var e = iter.Current;

                if (iter.MoveNext())
                {
                    throw new InvalidOperationException(string.Concat("multiple vertices exist with id '", id, "'"));
                }

                return(new IdVertex(e, this));
            }
            var base_ = _baseGraph.GetVertex(id);

            return(null == base_ ? null : new IdVertex(base_, this));
        }
        public IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            var vertex = BaseGraph.GetVertex(id);

            return(null == vertex ? null : new ReadOnlyVertex(this, vertex));
        }
Beispiel #5
0
        public IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            IVertex vertex = BaseGraph.GetVertex(id);

            if (null == vertex || !IsInPartition(vertex))
            {
                return(null);
            }

            return(new PartitionVertex(vertex, this));
        }
Beispiel #6
0
        /// <note>
        ///     If the input data are sorted, then out vertex will be repeated for several edges in a row.
        ///     In this case, bypass cache and instead immediately return a new vertex using the known id.
        ///     This gives a modest performance boost, especially when the cache is large or there are
        ///     on average many edges per vertex.
        /// </note>
        public IVertex GetVertex(object id)
        {
            GraphContract.ValidateGetVertex(id);
            if ((_previousOutVertexId != null) && (_previousOutVertexId == id))
            {
                return(new BatchVertex(_previousOutVertexId, this));
            }
            var v = RetrieveFromCache(id);

            if (v == null)
            {
                if (_loadingFromScratch)
                {
                    return(null);
                }
                if (_baseGraph.Features.IgnoresSuppliedIds)
                {
                    Debug.Assert(_vertexIdKey != null);
                    var iter = _baseGraph.GetVertices(_vertexIdKey, id).GetEnumerator();
                    if (!iter.MoveNext())
                    {
                        return(null);
                    }
                    v = iter.Current;
                    if (iter.MoveNext())
                    {
                        throw new ArgumentException(
                                  string.Concat("There are multiple vertices with the provided id in the database: ", id));
                    }
                }
                else
                {
                    v = _baseGraph.GetVertex(id);
                    if (v == null)
                    {
                        return(null);
                    }
                }
                _cache.Set(v, id);
            }
            return(new BatchVertex(id, this));
        }
Beispiel #7
0
 public IVertex GetVertex(object id)
 {
     GraphContract.ValidateGetVertex(id);
     return(_graph.GetVertex(id));
 }