The number and type of neighboring configurations that can be obtained from the inclusion in the current RPDAG of an edge between and can be determined from the parameters above. The resultant casuistry may be reduced to seven states, which we have labeled from to . In order to facilitate its description, we shall use the decision tree shown in Figure 106.

Figure 10:
The tree of possible states that may result by adding an edge between nodes and

In this tree, the lower box of each non-terminal vertex contains a test (about the number of parents or the number of neighbors of nodes and ). The lower box of each terminal vertex contains the label of the state resulting from following the path from the root to that terminal vertex. The description of each state (i.e. the different neighboring configurations that can be obtained in this case) can be found in Table 1. The upper boxes of all the vertices in the tree show the restrictions imposed on each intermediate or terminal state. For example, state B corresponds to a situation where both nodes and do not have neighbors and at least one of them has some parent. Although the tree has seven different states, there are only five truly different states, since states D and E, and states F and G are symmetrical.

Table 1:
Table of states that may result by adding an edge between nodes and

State

Number of

Added edges

Directed

Undirected

Completing ?

configurations

Cycles ?

Cycles ?

A

1

--

No

No

No

B

2

Yes

Yes

No

No

No

No

C

--

No

Yes

Yes

Yes

No

No

No

Yes

Yes

D

--

No

No

No

No

No

Yes

E

--

No

No

No

No

No

Yes

F

No

Yes

Yes

No

No

No

No

Yes

Yes

G

No

Yes

Yes

No

No

No

No

Yes

Yes

(1) only if and

(3) only if

(2) only if and

(4) only if

In Table 1, each row corresponds to a state: the first column contains the labels of the states; the second column displays the total number of neighboring configurations that can be obtained for each state; the third column shows the different types of edges that, for each state, can be added to the current configuration; columns four, five and six will be discussed later.

Using the example in Figure 8, we shall explain the use of the decision tree as well as the instantiation of the information in Table 1. Following the decision tree, at level 1 (the root vertex), the test is false since has two neighbors. At level 2, the test is also false as has one parent. At level 3 the test is true, since has no neighbor. At level 4 we reach a terminal vertex. Our current configuration therefore corresponds to state F. Then, by examining state F in Table 1, we can confirm that we reach four different configurations ():
,
without new h-h patterns, and two
which produce new h-h patterns. So, these are the only structures that our algorithm must evaluate when considering the inclusion of the candidate edge . In Figure 14, we show an example for each of the five non-symmetrical states (once again, these examples only display the part of the RPDAGs corresponding to the neighborhood of the nodes and ).

We therefore have a systematic way to explore all the neighboring configurations which result from adding an edge. However, it will sometimes be necessary to perform some additional steps since the configurations obtained must be RPDAGs:

First, we must maintain the condition 1 (
). It is therefore necessary to complete the configuration for some of the described states, i.e. some of the links must be converted into arcs. The completing process consists in firing an orientation in cascade, starting from the links such that the arc just introduced is
. Let us consider the situation in Figure 11, where we want to connect the nodes and , a case corresponding to state D. Among the three possible neighboring configurations, let us suppose that we are testing the one which introduces the h-h pattern
. The RPDAG obtained from the completing process is also displayed in Figure 11. The sixth column in Table 1 shows which states and neighboring configurations may require the completing process.

Figure 11:
Transformation of a configuration after including the pattern
and completing

Secondly, it is possible that some of the neighboring configurations must be rejected, as they give rise to directed or completely undirected cycles (conditions 2 and 3 defining RPDAGs). For example, let us consider the situation displayed in Figure 12, which corresponds to state F. In this case, the configuration obtained after including the arc
and completing would generate a directed cycle. This configuration must therefore be rejected. The columns four and five in Table 1 show which states and configurations may require a detection of directed or completely undirected cycles, respectively.