二叉堆密集图上的 Dijkstra 线性运行时间
第一:Dijkstras 最短路径算法的一般运行时间为
其中 m 是边数和 n 顶点数
第二:预期的减少键操作数如下
第三:带有二进制堆的 dijkstra 的预期运行时间,允许在 log(n) 时间内执行所有操作
但是,如果我们考虑一个图稠密的话,为什么稠密图上的运行时间是线性的
有人可以帮助这里的 O 表示法和日志计算吗?
First: The general running time of Dijkstras Shortest Path algorithm is
where m is the number of edges and n the number of vertices
Second: the number of expected decreasekey operations is the following
Third: The expected running time of dijkstra with a binary Heap which allows all operations in log(n) time is
But why is the running time on dense graphs linear if we consider a graph dense if
Can someone help with the O-notation and log calculations here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,不难证明如果
m
是n log(n) log(log(n))
的大欧米伽,那么log(n)< /code> 是
log(m)
的大欧米伽。因此,您可以证明m
是n log(m) log(log(m))
的大欧米伽。由此可以看出,
n
是m / (log(m) log(log(m)))
的大欧米伽。将其代入第三点中的表达式,我们得到预期的运行时间为:
从这里您可以将所有乘积日志展开为日志总和。你会得到很多条款。然后这只是一个证明每个人都是
O(m)
或o(m)
的问题。这很简单,但很乏味。First it isn't hard to show that if
m
is big omega ofn log(n) log(log(n))
thenlog(n)
is big omega oflog(m)
. Therefore you can show thatm
is big omega ofn log(m) log(log(m))
.From this you can show that
n
is big omega ofm / (log(m) log(log(m)))
.Substitute this back into the expression you have in the third point and we get that the expected running time is:
From here you can expand all of the logs of products into sums of logs. You'll get a lot of terms. And then it is just a question of demonstrating that every one is
O(m)
oro(m)
. Which is straightforward, though tedious.我的解决方案现在如下
my solution is now the following