コード例 #1
0
        private bool bothHave(EdgeValues <T> edVal, Graph <T> grph)
        {
            bool start = grph.searchVertex(edVal.startId);
            bool end   = grph.searchVertex(edVal.endId);

            if (start && end)
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
        // recursively edgeleri okuyup addedges yapan algoritmayı yaz.

        private bool onlyOneHave(EdgeValues <T> edVal, Graph <T> grph)
        {
            bool r     = false;
            bool start = grph.searchVertex(edVal.startId);
            bool end   = grph.searchVertex(edVal.endId);

            if (start && !end)
            {
                return(true);
            }
            else if (!start && end)
            {
                return(true);
            }

            return(false);
        }
コード例 #3
0
        private void travelEdges(Graph <T> grph)      // graphtaki tüm edgeleri dolaşarak listeye sıralı olarak ekliyor.
        {
            edgeList = new LinkedList <EdgeValues <T> >();
            Vertex <T> iteratorV = grph.head;

            while (iteratorV != null)
            {
                Edge <T> iteratorE = iteratorV.EdgeLink;

                while (iteratorE != null)
                {
                    var edVal = new EdgeValues <T>(iteratorV.Id, iteratorE.VertexId, iteratorE.Weight);
                    addEdges(edVal, grph);

                    iteratorE = iteratorE.Next;
                }
                iteratorV = iteratorV.Next;
            }
        }
コード例 #4
0
        private void addEdges(EdgeValues <T> edV, Graph <T> grph)
        {
            var newNode = new Node <EdgeValues <T> >(edV);

            edgeList.addSorted(newNode);
        }