Пример #1
0
        // Since we make edges both for incoming edges and outgoing edges every edge actually gets visited twice - once for it's incoming vertex
        // and once for it's outgoing vertex.  The first time we actually create the edge and the second time we need to reference the edge
        // created the first time.  dctEdge keeps track of previously created edges so we can find them on the second visit.  It has to be
        // be maintained during the entire construction of the graph so it's created in the graph constructor and passed down a rather large
        // call chain to be used here.
        private void MakeOutEdges(IGraphLoader <TV, TE> loader, int vid, Dictionary <VfEdge, VfEdge> dctEdge, List <int> mpIvtxGraphIvtxVf, ref VfEdge vfeKey)
        {
            for (var i = 0; i < loader.OutEdgeCount(vid); i++)
            {
                TE attr;
                vfeKey.IvtxTo = mpIvtxGraphIvtxVf[loader.PosFromId(loader.GetOutEdge(vid, i, out attr))];

                if (!dctEdge.ContainsKey(vfeKey))
                {
                    _outEdges[i] = dctEdge[vfeKey] = new VfEdge(vfeKey.IvtxFrom, vfeKey.IvtxTo, attr);
                    vfeKey       = new VfEdge(vfeKey.IvtxFrom, vfeKey.IvtxTo, null);
                }
                else
                {
                    _outEdges[i] = dctEdge[vfeKey];
                }
            }
        }
Пример #2
0
        private void MakeOutEdges(IGraphLoader loader, int nid, Dictionary <VfeNode, VfeNode> dctEdge, int[] mpInodGraphInodVf, ref VfeNode vfeKey)
        {
            object attr;

            for (int i = 0; i < loader.OutEdgeCount(nid); i++)
            {
                vfeKey._inodTo = mpInodGraphInodVf[loader.PosFromId(loader.GetOutEdge(nid, i, out attr))];

                if (!dctEdge.ContainsKey(vfeKey))
                {
                    _arvfeEdgeOut[i] = dctEdge[vfeKey] = new VfeNode(vfeKey._inodFrom, vfeKey._inodTo, attr);
                    vfeKey           = new VfeNode(vfeKey._inodFrom, vfeKey._inodTo, null);
                }
                else
                {
                    _arvfeEdgeOut[i] = dctEdge[vfeKey];
                }
            }
        }