Beispiel #1
0
        int IComparable.CompareTo(object obj)
        {
            IndexEdge lhs = this;
            IndexEdge rhs = (IndexEdge)obj;

            /*
             * return lhs.weight == rhs.weight ? lhs.targetID - rhs.targetID
             *  : lhs.weight - rhs.weight;
             */
            return(lhs.weight - rhs.weight);
        }
Beispiel #2
0
        public void deleteEdge(VertexKey ownerID, VertexKey targetID)
        {
            IndexEdge it = listFind(edgeData[ownerID], targetID);

            if (it == null)
            {
                //do nothig
            }
            else
            {
                edgeData[ownerID].Remove(it);
            }
        }
Beispiel #3
0
        public void insertEdge(Edge e)
        {
            IndexEdge it = listFind(edgeData[e.ownerID], e.targetID);

            if (it == null)
            {
                edgeData[e.ownerID].AddLast(e);
            }
            else
            {
                //已存在: 边数不增加 直接更新就行
                it.weight = e.weight;
            }
        }