Plotting nodes on a graph based on node-pair distances
I was wondering if someone could help with the following problem.
I have a dozen nodes, each a different sized circle between 0 - 10. I have a distance for each node-pair (e.g. node A and B are 6 from each other, etc.)
Given this data, would it be possible to compute the position of each node on a grid?
The distance could be 开发者_开发技巧from the centre or the edge of a node.
Thanks.
If you just want to have a graph to look at, try building a neato file where you specify edge distance. Neato is a layout program that is part of the GraphViz package.
This is quite easy. Your example above would look like this:
graph G {
A -- B [len=6]
}
精彩评论