5.337. tree
| DESCRIPTION | LINKS | GRAPH |
- Origin
N.Β Beldiceanu
- Constraint
- Arguments
- Restrictions
- Purpose
Cover a digraph by a set of trees in such a way that each vertex of belongs to one distinct tree. The edges of the trees are directed from their leaves to their respective roots.
- Example
-
The constraint holds since the graph associated with the items of the collection corresponds to two trees (i.e.,Β ): each tree respectively involves the vertices and . They are depicted by FigureΒ 5.337.1.
Figure 5.337.1. The two trees associated with the example

- Symmetry
Items of are permutable.
- Remark
Given a complete digraph of vertices as well as an unrestricted number of trees , the total number of solutions of the corresponding constraint corresponds to the sequence A000272 of the On -Line Encyclopedia of Integer SequencesΒ [Sloane10].
Extension of the constraint to the minimum spanning tree constraint is described inΒ [DoomsKatriel06], [Regin08], [ReginRousseauRueherHoeve10].
- Algorithm
An arc-consistency filtering algorithm for the constraint is described inΒ [BeldiceanuFlenerLorca05]. This algorithm is based on a necessary and sufficient condition that we now depict.
To any constraint we associate the digraph , where:
To each item of the collection corresponds a vertex of .
For every pair of items of the collection, where and are not necessarily distinct, there is an arc from to in if is a potential value of .
A strongly connected component of is called a sink component if all the successors of all vertices of belong to . Let and respectively denote the number of sink components of and the number of vertices of with a loop.
The constraint has a solution if and only if:
Each sink component of contains at least one vertex with a loop,
The domain of has at least one value within interval .
Most likely, the worst case complexity of the algorithm proposed inΒ [BeldiceanuFlenerLorca05] may be enhanced by using the linear time algorithm presented inΒ [ItalianoLauraSantaroni10] for computing the strong articulation points of the digraph .
- Reformulation
The constraint can be expressed in term of (1)Β a set of reified constraints for avoiding circuit between more than one node and of (2)Β reified constraints and of one sum constraint for counting the trees:
For each vertex of the collection we create a variable that takes its value within interval . This variable represents the rank of vertex within a solution. It is used to prevent the creation of circuit involving more than one vertex as explained now. For each pair of vertices of the collection we create a reified constraint of the form . The purpose of this constraint is to express the fact that, if there is an arc from vertex to another vertex , then should be strictly less than .
For each vertex of the collection we create a 0-1 variable and state the following reified constraint in order to force variable to be set to value 1 if and only if there is a loop on vertex . Finally we create a constraint for stating the fact that the number of trees is equal to the number of loops of the graph.
- Systems
- See also
common keyword: , , Β (graph partitioning constraint), Β (connected component,tree).
related: , Β (can be used for restricting number of children since discard loops associated with tree roots).
shift of concept: , , .
specialisation: Β (no limit on the number of children replaced by at most two children), Β (no limit on the number of children replaced by at most one child).
- Keywords
constraint type: graph constraint, graph partitioning constraint.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph model
We use the graph property in order to specify the fact that the size of the largest strongly connected component should not exceed one. In fact each root of a tree is a strongly connected component with one single vertex. The second graph property enforces the number of trees to be equal to the number of connected components.
PartsΒ (A) andΒ (B) of FigureΒ 5.337.2 respectively show the initial and final graph associated with the Example slot. Since we use the graph property, we display the two connected components of the final graph. Each of them corresponds to a tree. The constraint holds since all strongly connected components of the final graph have no more than one vertex and since .
Figure 5.337.2. Initial and final graph of the constraint


(a) (b)