[ library(gfd) | Reference Manual | Alphabetic Index ]
# <ConsistencyModule:> inverse(+Succ,+SuccOffset,+Pred,+PredOffset)

Constrains elements of Succ (with SuccOffset) to be the successors and Pred (with PredOffset) to be the predecessors of nodes in a digraph
*Succ*
- A collection of N different(domain) variables or integers
*SuccOffset*
- An integer.
*Pred*
- A collection of N different (domain) variables or integers
*PredOffset*
- An integer.

## Description

Succ and Pred are list of N elements, representing a digraph of N nodes,
where the i'th element of Succ and Pred represents the successor and
predecessor of the node i respectively. The constraint enforces each
node in the digraph to have one successor and one predecessor node, and
that if the successor of node y minus SuccOffset is equal to x, then
the predecessor of node x minus PredOffset is equal to y.

One of the two collection arguments (Succ and Pred) can be uninstantiated
or partial list at call time.

Note that the gecode implementation of this constraint actually index
from 0. The SuccOfffset and PredOffset are adjusted accordingly before
posting to gecode so that the indices returned corresponds to
ECLiPSe's (starting from 1).

ConsistencyModule is the optional module specification to give the
consistency level for the propagation for this constraint:
gfd_gac for generalised arc consistency (domain consistency),
and gfd_vc for value consistency.

This constraint is known as inverse_offset in the global constraint
catalog, but with implicit node index based on the position in the list.
It is implemented using Gecode's channel() constraint (variant with two
IntVarArgs and two integer offsets).

## See Also

inverse_g / 4