0

I am using a matrix to represent an 'upstream' relation. so this:

$$a \longrightarrow b \longrightarrow c$$ (which is read "$a$ is upstream of $b$, $b$ is upstream of $c$") becomes: $$\begin{pmatrix} 0&1&1 \\ 0&0&1 \\ 0&0&0\end{pmatrix}$$

One of the requirements of this system is that the matrix be asymmetric (if $x$ is upstream of $y$ then $y$ cannot be upstream of $x$) and transitive (if $x$ is upstream of $y$ and $y$ is upstream of $z$ then $x$ is upstream of z). These two properties are easy to check: one can easily check symmetry (i.e. which elements are equal to 1 for both $M$ and $M^T$) and also transitivity (using this MSE question).

I am constructing these matrices from data that may be inconsistent or incomplete, so I need some tests to tell me where my matrix violates certain assumptions

One such assumption is that if any two elements $a$ and $b$ are 'between' two other elements $c$ and $d$, then either $a$ is upstream of $b$ or $b$ is upstream of $a$.

$$c \longrightarrow (a?/b?) \longrightarrow d$$

$$ (c,a) \land (c,b) \land (a,d) \land (b,d) \Rightarrow (a,b) \lor (b,a)$$

$$\begin{matrix} \\0&?&0&1 \\ ?&0&0&1 \\ 1&1&0&1 \\ 0&0&0&0 \end{matrix}$$

My question is this: Is there a way to easily test this last assumption using matrix operations? Or even better, find all entries which violate such an assumption? These matrices can be hundreds if not thousands of rows, so preferably something that doesn't require much iteration.

1 Answers1

0

A few ideas, perhaps an answer.

I think your conditions are better expressed in graph theory language than in matrix language (although some graph algorithms are best implemented with the adjacency matrix representation you have).

Your notion of "upstream" says you have a directed graph. (You seem to know that.)

The consistency requirement says (I think) that you can never have two different paths from $c$ to $d$. That means your graph is essentially a tree with root the minimal element. So look for a graph algorithm that tells you when your graph is a tree.

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199