How to find the optimal mesh placement for the smallest distance between the nodes of the network?

If I wanted to display the nodes on a 2D grid, but also I would like to ensure the smallest amount of Manhattan distance between any two directly connected nodes (where there is a maximum of 1 node per cell), what is the algorithm for doing this?

To clarify, let me give you a simple example:

The network has the following topology: A โ†’ B โ†’ C

One solution for grid placement would be to simply list 3 items next to each other:

| A | B | C |

The distance between any two connecting nodes is 1 cell.

Suppose another network has the following topology: A โ†’ B โ†’ C โ†’ D โ†’ A

One solution for this network would be: | A | B | | D | C |

The distance between A and B, B and C, C and D and D and A is 1 cell. B and D, and A and C are not directly related, so their distances do not affect the problem.

The most optimal layout will be the one that provides the smallest total distance between all directly connected nodes.

Now how do I do this for an arbitrary network? Any help would definitely be appreciated. :)

+3


source to share


1 answer


The division-and-conquest approach may have some fruit. Consider the following algorithm:

if the graph cardinality is less than 10:

1) Create a 3x3 grid. Place this node of this part of the graph on the grid in such a way as to minimize the distance.

2) Return the 3x3 mesh

yet



1) Divide the graph into two sets of nodes, recursive on each. Each recursion returns a graph of the optimal way to lay out this subset of the graph in a grid. Ideally, you will find the minimum halving for this split, but this is an NP-hard problem , so maybe an approximation?

2) Concatenate the two subgraphs, creating a single grid, with two recursive calls returning next to each other. You can rotate the return of a recursive call 90 degrees without changing its distance sum, so there are 16 (4 orientations) ways to combine two grids. Large, but fortunately permanent. Return a merged mesh that minimizes the overall distance.

Obviously, the factor that breaks this algorithm is connections spanning subgrids. The rotation process partially corrects this.

If you know your graph is flat, this is probably the best way to do it. Otherwise, you can stick with approximation as your best solution, since for any given node with degree> 4, you need to choose at least one neighbor to put at distance> = 2.

Another thing to consider is to take the innermost step towards optimal placement of <= 9 nodes in a 3x3 grid. The problem is that there are probably many equally optimal ways to put nodes on the grid in terms of subnetting costs, but you also want to make sure that the nodes with their corresponding outgoing edges (the edges outgoing from this sub problem) are on the same side of the grid ...

0


source







All Articles