private Endpoints UncheckedAdd(int tail, int head)
            {
                _currentMaxTail = tail < _currentMaxTail ? int.MaxValue : tail;
                int newVertexCountCandidate = Math.Max(tail, head) + 1;

                if (newVertexCountCandidate > _vertexCount)
                {
                    _vertexCount = newVertexCountCandidate;
                }

                var edge = new Endpoints(tail, head);

                _edges = ArrayPrefixBuilder.Add(_edges, edge, false);

                return(edge);
            }
            private int UncheckedAdd(int tail, int head)
            {
                int newVertexCountCandidate = Math.Max(tail, head) + 1;

                if (newVertexCountCandidate > _vertexCount)
                {
                    _vertexCount = newVertexCountCandidate;
                }

                Debug.Assert(_tailByEdge.Count == _headByEdge.Count, "_tailByEdge.Count == _headByEdge.Count");
                int edge = _tailByEdge.Count;

                _tailByEdge = ArrayPrefixBuilder.Add(_tailByEdge, tail, false);
                _headByEdge = ArrayPrefixBuilder.Add(_headByEdge, head, false);

                return(edge);
            }
Пример #3
0
            private Endpoints UncheckedAdd(int tail, int head)
            {
                int newVertexCountCandidate = Math.Max(tail, head) + 1;

                if (newVertexCountCandidate > _vertexCount)
                {
                    _vertexCount = newVertexCountCandidate;
                }

                var edge = new Endpoints(tail, head);

                _edges = ArrayPrefixBuilder.Add(_edges, edge, false);
                ++_edgeCount;

                if (tail != head)
                {
                    var invertedEdge = new Endpoints(head, tail);
                    _edges = ArrayPrefixBuilder.Add(_edges, invertedEdge, false);
                }

                return(edge);
            }