Suppose that I have a complete, undirected graph G with a distance associated with each edge. The meaning of edge (u, v) having length l is "points u and v can't be any closer to each other than l." My goal is to lay the nodes of this graph out in a plane so that none of these distance constraints are violated and such that the convex hull of the points has the least total area. As an example, suppose that I have a bunch of electrical components I want to put onto a chip, each of which generates some amount of electrical interference. If I put the components too close together, they'll start interfering with one another, rendering the whole system useless. Given the minimum distances each point should be from each other point, what's the most space-efficient way of putting the components on a chip?
I have no idea how to even start thinking about this. I also don't know how the problem might generalize to the higher-dimensional case (packing points into a hyperplane). Does anyone know of a good way of tackling this problem?
These atoms are closed packed, ie they cannot be packed any tighter, and each atom touches its neighbor in any direction. Since a close packed plane such as this can be achieved by removing each of the eight corner atoms and because eight such planes form an octahedron, they are called the 'Octahedral' planes.
In a close-packed structure the close packed directions are the directions in which atoms are touching. For a hcp structure the close packed directions are [100], [010] and [110] and their negatives. Directions that are related by symmetry are represented using the notation <UVW>.
The term "closest packed structures" refers to the most tightly packed or space-efficient composition of crystal structures (lattices). Imagine an atom in a crystal lattice as a sphere. While cubes may easily be stacked to fill up all empty space, unfilled space will always exist in the packing of spheres.
I have an optimal solution, but you aren't going to like it :).
Let's label our nodes x0, x1, ..., xn. Let B = maxi,j < n(dist(xi, xj)), where dist(xi, xj) is the minimum distance between xi and xj. For each i, place node xi at position (0, i*B). Now each node is at least B away from all the others, and the convex hull has area 0.
The real point here is that minimizing the area of the convex hull alone will give you a nonsensical solution. A possibly better measure would be the diameter of the convex hull.
I guess it'll be hard to find the optimal algorithm. I wouldn't be surprised if it turned out to be an NP-hard problem. However, if you're interested in a practical algorithm that yields decent solutions, I recommend to take a look at force-based graph drawing algorithms.
Here's the general idea (some higher math. will appear). It generalizes to any number of dimensions.
Construct a function f
which assigns a value to each node layout – a value that you want to minimize. In your case, the function could calculate the area of the convex hull for a given layout + a big penalty for each constraint that wasn't met. Or it could be a simpler function g
which reasonably approximates the former one: in short, we want g
to get smaller whenever f
gets smaller, and vice versa. It is good to choose a relatively simple function, because you will need to calculate its partial derivatives (with respect to coordinates of nodes).
Now let's say you've got 100 nodes and you want to lay them out in 3D. That means you have 300 unknown numbers (100 nodes times 3 coordinates for each node). Function f
is a function from R300 to R, and ideally we want to find it's global minimum. More realistically, a sufficiently deep local minimum will suffice.
There are well known numerical algorithms for finding such a minimum, for example: Conjugate gradient, BFGS. Good thing is, you don't really have to understand them in details, these algorithms are implemented in many languages. All you have to do is to provide a method of calculating f(x)
and f'(x)
for any x
requested by the algorithm, and an initial layout x₀
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With