有一个算法,给了我在图中坐标的顶点,当我给他一个加权图和顶点点之间的边的权到距离顶点之间 ?
是这样的:
公共_ArrayOfCoordinatesForVertices_ ** super_hyper_algorithm **(weighted_graph){
返回_foo_;
}
解决方案
这是一般不可能的:想象一下,有3个节点N1,N2和N3图
现在考虑下面的距离:
N1-N2:4
N1-N3:1
N2-N3:1
(这违反了三角不等式的推广)。
Is there an algorithm that gives me coordinates of vertices in a graph, when I give him a weighted graph and the edge weights between vertices points to the distance between vertices?
Something like:
public _ArrayOfCoordinatesForVertices_ **super_hyper_algorithm**(weighted_graph){
return _foo_;
}
解决方案
This is in general not possible: Imagine a graph with 3 nodes n1, n2, and n3.
now consider the following distances:
n1-n2: 4
n1-n3: 1
n2-n3: 1
(This violates the triangle inquality).