private void AddConnectivity(GdbObjectReference objRef,
                                     int fromNodeIndex, int toNodeIndex, float weight,
                                     bool respectLineOrientation,
                                     ICollection <AdjacentNode> connectedNodesAtFrom,
                                     ICollection <AdjacentNode> connectedNodesAtTo)
        {
            // adjacency:
            int edgeIndex = EdgeReferences.Count;

            EdgeReferences.Add(objRef);

            // Allow adding the edge, even if its to point is outside the AOI and no connection can
            // be made. It is still relevant for the node degree count (number of edges at from).
            if (fromNodeIndex >= 0)
            {
                var fromToEdge = new AdjacentNode(toNodeIndex, weight, edgeIndex);
                connectedNodesAtFrom.Add(fromToEdge);
            }

            if (!respectLineOrientation && toNodeIndex >= 0)
            {
                var toFromEdge = new AdjacentNode(fromNodeIndex, weight, edgeIndex);
                connectedNodesAtTo.Add(toFromEdge);
            }
        }
        public void Reset()
        {
            Nodes.Clear();
            NodeIndexesByNode.Clear();

            Connections.Clear();
            EdgeReferences.Clear();

            EdgeInteriorNodesByEdge.Clear();
        }