I have a loosely connected graph. For every edge in this graph, I know the approximate distance d(v,w) between node v y w en posiciones p(v) y p (w) as a vector in R3, not only as an euclidean distance. The error shall be small (lets say < 3%) and the first node is at <0,0,0>.
If there were no errors at all, I can calculate the node-positions this way:
set p(first_node) = <0,0,0> calculate_position(first_node) calculate_position(v): for (v,w) in Edges: if p(w) is not set: set p(w) = p(v) + d(v,w) calculate_position(w) for (u,v) in Edges: if p(u) is not set: set p(u) = p(v) - d(u,v) calculate_position(u)
The errors of the distance are not equal. But to keep things simple, assume the relative error (d(v,w)-d'(v,w))/E(v,w) is N(0,1)-normal-distributed. I want to minimize the sum of the squared error
sum( ((p(v)-p(w)) - d(v,w) )^2/E(v,w)^2 ) for all edges
The graph may have a moderate amount of Nodes ( > 100 ) but with just some connections between the nodes and have been "prefiltered" (split into subgraphs, if there is only one connection between these subgraphs).
I have tried a simplistic "physical model" with hooks low but its slow and unstable. Is there a better algorithm or heuristic for this kind of problem?
preguntado el 05 de mayo de 13 a las 21:05
Esto parece regresión lineal. Take error terms of the following form, i.e. without squares and split into separate coordinates:
(px(v) - px(w) - dx(v,w))/E(v,w) (py(v) - py(w) - dy(v,w))/E(v,w) (pz(v) - pz(w) - dz(v,w))/E(v,w)
If I understood you correctly, you are looking for values
pz(v) para todos los nodos
v such that the sum of squares of the above terms is minimized.
You can do this by creating a matrix A y un vector b in the following way: every fila corresponds to one of ecuación of the above form, and every visión de conjunto of A corresponde a uno variable, i.e. a single coordinate. For n vértices y m edges, the matrix A tendrá 3m rows (since you separate coordinates) and 3n−3 columns (since you also fix the first node
The row for
(px(v) - px(w) - dx(v,w))/E(v,w) would have an entry
1/E(v,w) en la columna de
px(v) and an entry
-1/E(v,w) en la columna de
px(w). All other columns would be zero. The corresponding entry in the vector b sería
Now solve the ecuación lineal (AT·A)x = AT·b sin que importe AT denota el transponer of A. The solution vector x will contain the coordinates for your vertices. You can break this into three independent problems, one for each coordinate direction, to keep the size of the linear equation system down.