def networkDelayTime(self, edges, N, S, D = None):
# for (d, t) in edges[s], it means that there is a one-way path from s to d with cost t
# N is the number of all vertexes, S is the source vertex, D if present is the target destination vertex
FAIZ = (1 + math.sqrt(5)) / 2
nodes = [None] * N
class node(object):
def __init__(self, i, value):
self.i = i
self.val = value
self.degree = 0
self.left = self
self.right = self
self.parent = None
self.child = None
self.marked = False
nodes[i] = self
def addNode(nd, dbn): #dbn for 'a node in the double-linked list'
nd.left = dbn.left
dbn.left.right = nd
nd.right = dbn
dbn.left = nd
def heapPush(nd):
addNode(nd, self.minNode)
def removeNode(
python Dijkstra算法 + 斐波那契堆
最新推荐文章于 2022-03-28 19:50:30 发布