How can one efficiently group the nodes of a directed acyclic graph to make collective nodes?

94 Views Asked by At

The adjacency matrix $A$ of the transitive closure of a directed acyclic graph can have a `checkerboard' pattern like \begin{equation} A = \begin{pmatrix} 0 & ? & ? & ? & {\bf a} & {\bf a} & b & b & b & {\bf c} \\ ? & 0 & ? & ? & {\bf a} & {\bf a} & b & b & b & {\bf c} \\ ? & ? & 0 & ? & {\bf a} & {\bf a} & b & b & b & {\bf c}\\ ? & ? & ? & 0 & {\bf a} & {\bf a} & b & b & b & {\bf c}\\ {\bf a}' &{\bf a}' & {\bf a}' & {\bf a}' & 0 & ? & {\bf d} & {\bf d} & {\bf d} & e \\ {\bf a}' & {\bf a}' & {\bf a}' & {\bf a}' & ? & 0 & {\bf d} & {\bf d} & {\bf d} & e \\ b' & b' & b' & b' & {\bf d}' & {\bf d}' & 0 & ? & ? & {\bf f} \\ b' & b'& b'& b' & {\bf d}' & {\bf d}' & ? & 0 & ? & {\bf f} \\ b' & b'& b' & b' & {\bf d}' & {\bf d}' & ? & ? & 0 & {\bf f} \\ {\bf c}' & {\bf c}' & {\bf c}' & {\bf c}' & e' & e' & {\bf f}' & {\bf f}' & {\bf f}' & 0\end{pmatrix}\ . \end{equation}

The alternate light and heavy fonts are here just to make the `checkerboard' pattern of the lettered constants apparent to the eye.

Each of the square blocks along the diagonal can be viewed as representing a set of nodes that forms in a sense its own collective node; in my work it has been profitable to study the related four-node graph whose adjacency matrix is $$\begin{pmatrix} 0 &{\bf a} & b & {\bf c}\\ {\bf a}' & 0 & {\bf d} & e\\ b' & {\bf d}' & 0 & {\bf f}\\ {\bf c}' & e' & {\bf f}' & 0\\ \end{pmatrix}\ .$$

Question: given any adjacency matrix where the nodes have not already been assigned to sets that make the checkerboard pattern plain, how can this sort be efficiently done?

1

There are 1 best solutions below

0
On

This problem may belong just to the general mathematics of matrices and not require special knowledge of adjacency matrices at all, just knowledge of their basic properties:

The elements of an adjacency matrix are all $0$'s and $1$'s, and any above-diagonal element $A_{ij}$ and its below-diagonal counterpart $A_{ji}$ must form one of the pairs $(1,0)$, $(0,1)$, and $(0,0)$. The diagonal elements are $0$.

If an adjacency matrix represents a transitive closure, then if $A_{ij}=1$ and $A_{jk}=1$, then $A_{ik}=1$. The $4\times 4$, $2\times 2$, $3\times 3$, and $1\times 1$ blocks along the diagonal of the example above are otherwise arbitrary.

Some problems cannot be reduced to fewer nodes than in the original problem.

One can split the nodes into a set $I$ and a set $J$ and see if the set $I$ forms a collective node by checking if for each $j\in J$ all the values $A_{ij}$ for $i\in I$ match, and all the values $A_{ji}$ also match. If one finds a collective node, finding the next reduces to another solving the same general problem but with an adjacency matrix with fewer nodes, which is helpful; still, running through all the sets is slow and I am looking for a better approach.