igraph:获取最长测地距离
我的问题如下: 考虑一个具有 10000 个节点和 4800 个边的非直接图。 给定这个图并给定这个图的一个节点(例如,节点1),我需要igraph(R)中的一个命令来获取这个节点1和图中最远节点之间的距离。非常感谢您的帮助! :)
亲切的问候, 伊格纳西奥.
My question is the following:
Consider a undirect graph with 10000 nodes and 4800 edges.
Given this graph and given a node of this graph (for example, node 1), I need a command in igraph (R) to obtain the distance between this node 1 and the farest node in the graph, please. Thanks a lot, for your help! :)
Kind regards,
Ignacio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这本质上是一个探路者/搜索。
假设如果两个节点已连接,则 isConnected(a,b) 返回
(我正在用 Lua 编写代码,翻译起来应该不难)
submit_list
是一个接受列表并检查的函数他们。它找到最长且不包含重复项的提交列表。该列表将解决您的问题。哦,还有一件事;我的代码没有说明什么。如果列表包含重复节点,该函数应该终止,这样它就不会永远递归。
That's essentially a pathfinder/search.
Assume that isConnected(a,b) returns if the two nodes are connected
(I am writing the code in Lua, it shouldn't be hard to translate)
submit_list
is a function which takes lists, and checks them. It finds the longest submitted list that contains no duplicates. That list will be the solution to your problem.Oh, one other thing; my code doesn't account for something. In the event that the list contains duplicates nodes, that function should terminate so that it doesn't recurse forever.
让我们制作一个图表,
它将找到到顶点 2 的距离
找到最远顶点的索引
显示路径
Let's make a graph
this will find the distances to vertex 2
Find the index of the furthest vertex(s)
Display the path