I\'ve been using GridLayout for a few weeks now and I\'ve noticed that when I call
gridLayout.requestLayout()
it spits out the following de
From the GridLayout
source:
Bellman-Ford variant - modified to reduce typical running time from O(N^2)
to O(N)
GridLayout converts its requirements into a system of linear constraints of the form:
x[i] - x[j] < a[k]
Where the x[i]
are variables and the a[k]
are constants.
For example, if the variables were instead labeled x
, y
, z
we might have:
x - y < 17
y - z < 23
z - x < 42
This is a special case of the Linear Programming problem that is, in turn, equivalent to the single-source shortest paths problem on a digraph, for which the O(n^2)
Bellman-Ford algorithm the most commonly used general solution.
It has a solve
method that is using linear programming to guarantee the consistency of the constraints it has to satisfy, given its configuration. You can probably improve your layout performance if you figure out which configuration is associated with the constraint x5 - x4 < 221
and remove it. Then the solver won't have to solve that it can't be satisfied and remove it itself.