Dijkstra路径权重

发布于 2024-11-29 08:58:34 字数 122 浏览 1 评论 0原文

Dijkstra

为什么某些路径的权重比其他等长路径明显多/少?在 Dijkstra 中,长度和路径权重不相等吗?

Dijkstra

Why would some paths have significantly more / less weights than other equal length paths? In Dijkstra's do length and path weight not equate?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

软甜啾 2024-12-06 08:58:34

您的意思是的图形表示与每条路径的权重不对应?

他们也没有……视觉表现只是一种表现,没有别的。不一定等于重量。

您可以按照自己喜欢的方式重新绘制图形,只需确保保留顶点之间的连接即可。

编辑:无论您处理哪种图表,无论是 Dijkstra 还是任何其他图表,都无关紧要。您甚至可以找到方向重要的图表:从 A 到 B 的权重可以是 10,从 B 到 A 的权重可以是 30。没问题。

编辑 2:图像仅显示顶点如何相互连接。该图像不需要与存储在程序中的图形成比例。有时,您的图形会有太多的顶点和边,以至于您无法以良好的方式表示它。对于你的编程问题来说,重要的是顶点、边及其权重。该图像只是它的粗略表示。您可以根据需要重新绘制图像,只需确保放置所有顶点、所有边以及每条边的所有权重即可。

You mean that the graphical representation of the graph doesn't correspond to the weight each path has ?

They don't have too... the visual representation is just a representation, nothing else. It isn't oblied be equivalent of the weight.

You could redraw the graph anyway you like, just making sure that the connections between the vertices are kept.

Edit: and it doesn't matter what kind of graph you're dealing with, be it Dijkstra or any other. You can even fidn graphs where the direction matters: From A to B the weight can be 10 and from B to A the weight can be 30. No problem.

Edit 2: the image just shows how the vertices connect to each other. The image doesn't need to be in scale with the graph that is stored in your program. Sometimes you'll have graphs with so many vertices and edges that you won't be able to represent it in a good way. What matters for your programing problems are the vertices, the edges, and it's weights. The image is just a rough representation of it. You can redraw the image as you like, you just have to make sure to put all vertices, all edges, and all weights for each edge.

沩ん囻菔务 2024-12-06 08:58:34

路径的长度(如图中线条的大小)无关紧要,它只是为了使其看起来不错。线路的权重表示两个节点之间的行驶成本。

但这很令人困惑,你可以通过改变图表的绘制方式来使长度=重量。

The length of the path (as in the size of the line in the diagram) is irrelevant, it's only to make it look nice. The weight of the line indicates the cost of travelling between two nodes.

It is confusing though, and you could make length = weight by changing the way the graph is drawn.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文