Constraints that you specify can become invalid. For
instance, if you add a constraint that node
A
must
be to the left side of node B
, but you
remove A
from the graph, then this constraint
becomes invalid. It simply does not make sense any more, even though
it does not conflict with any other constraint. The layout instance
automatically removes invalid constraints from time to time because
they are a waste of memory. The validation check is done during layout.
Forcing a validation check is normally not necessary but if you want
to do it, call: layout.validateConstraints();
It removes all invalid constraints from the Hierarchical
Layout and cleans up the memory. The constraint validation does not
check which constraints have conflicts. The main effect of the validation
is that the constraint system uses less memory afterward.
Note
A constraint is valid if it is meaningful. Two valid
constraints are conflicting if the system cannot satisfy them both
at the same time. Invalid constraints cannot be conflicting because
they are meaningless.
Hence, constraint validation and constraint resolution
are different phases. Constraint validation performs a quick local
test. It removes invalid constraints from the layout instance completely.
It does not affect conflicting constraints.
Constraint resolution checks whether a set of valid constraints
are in conflict with each other. Thus, constraint resolution is a
complex process on a network of multiple related constraints. Constraint
resolution decides which constraints can be solved and which cannot.
But the constraint resolution does not remove conflicting constraints
from the layout instance, it delivers a solution that can ignore some
constraints.