[ library(fd_global) | Reference Manual | Alphabetic Index ]

# inverse(+Succ, +Pred)

Constrains elements of Succ to be the successors and Pred to be the predecessors of nodes in a digraph

Succ
  A collection of N different variables or integers
Pred
  A collection of N different variables or integers

## 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 predessor node, and that if node y is the successor of node x, then node x is the predecessor of node y.

This is currently a prototype -- the constraint has not been tested very extensive and little effort has been spent to optimise performance. We welcome any feedback on using this constraint.

This constraint is known as inverse in the global constraint catalog, but with implicit node index based on the position in the list.