• Tidak ada hasil yang ditemukan

Edge Matrices

Dalam dokumen Networks of Relations (Halaman 42-46)

1.10 Matrix Networks

1.10.1 Edge Matrices

If we look at a pipe segment in a zipper network, we see that between the two relations at the ends, the zipper lines provide a number of paths. In fact, for any given tuple in the relation at the left end, and any given tuple in the relation at the right end, the zipper lines provide zero or more distinct paths between those two entries. Furthermore, zipper operations within this pipe segment all preserve this number exactly. We can create a matrix of these numbers, with a row for each tuple of the left relation, and a column for each tuple of the right relation, where each entry gives the number of distinct paths

connecting the row’s tuple on the left with the column’s tuple on the right. This matrix is unchanged by zipper operations within the segment. In fact, it is easy to see that matrices of the appropriate dimensions having non-negative integer entries can be put in 1-1 correspondence with canonical forms for the zippers. The meaning of the matrix is simply how many solutions that pipe segment has for each possible pair of tuples at the two ends. We can represent every edge in a network of relations by such a matrix, and then the relations can be eliminated from the vertices, losing no information. We call the result a matrix network.

Suppose a vertex in a matrix network has degree 2. Then we can simply multiply the matrices on either side together to get a single matrix giving the correct number of paths between any pair of tuples from the vertex’s two neighbors. (Depending on how the matrices were constructed, one or both of them may need to be transposed first. Since it is obvious from the meanings of the indices when this sort of transposition needs to be done, we will assume such transpositions will be done as needed in the discussion below.)

If a matrix network has the shape of a cycle, then we can multiply the matrices together all the way around the cycle until we just have a single matrix, which will be a square matrix.

We can see that the trace of this matrix (the sum of the entries on its main diagonal) is then the total number of solutions for the original network of relations that was converted to this matrix network.

Can we extend this to general graphs, so that a simple sequence of matrix multiplications can give us the number of solutions to an arbitrary network of relations? Not in any practical way, we can’t, because one of the things we could then do this way is solve NP-complete problems such as circuit satisfiability.

How about for trees? For example, zippers on trees can easily find the number of solutions, so we know that finding the number of solutions for a tree of relations is tractable.

How would we do it with matrices? Well, a tree must have a leaf, and leaves are of degree 1, so they are particularly easy to zip and unzip using the zipper-junction rule. If we fully unzip it, and then zip all the tuples together into a single tuple with one large zipper, then the matrix on its edge becomes a vector. This vector can then be included in one of the other matrices on an edge touching the parent of the leaf, simply by multiplying each row by the corresponding element of the vector. In this way, the leaf can be pruned. We can repeat this process until there is just one edge left, and at that point the sum of all entries

in the remaining matrix gives the total number of solutions to the network of relations. So trees are efficiently solvable, where solvable means counting the number of solutions.

We can combine the method used for a cycle with the method used for a tree, so if we have a tree of cycles (i.e., a graph in which no two vertices are connected by more than two disjoint paths), then at each step we can either prune a leaf as described, or we can similarly prune a “leaf cycle” (a cycle having only one vertex of degree greater than two), by going around the cycle as described, starting and ending at the high-degree vertex, and then using the trace as the vector to multiply into another matrix as done for the leaf.

Since the trace is a basis-independent quantity, we may wonder if the types of matrix operations we are doing are all basis-independent operations. To understand how this question can even make sense, we have to notice that each vertex is in its own vector space, so the only possible change of basis is at a vertex. How would we change the basis at a vertex? Given a matrix M that takes vectors in the old basis to vectors in the new basis (which need not be of the same length), we would be inclined to multiply M into each of the edge matrices adjacent to the vertex, since this at least gets all the dimensions right.

But how can we decide if this was the right thing to do? What would make it right or wrong? To answer this, let us introduce vertex tensors.

At a vertex of degree d, we can represent the number of d-way paths to each possible combination of d tuples (one from each of the dneighbor vertices) in a big d-dimensional matrix, ortensor. We will call this thevertex tensorfor the vertex. Given a matrix network, the vertex tensor for a vertexv can be computed from the matrices on the edges that touch v. Specifically, for each combination ofdtuples at thedneighbors, we can collect, from each of the dmatrices, the length-n vector corresponding to the chosen tuple at that neighbor, where nis the number of tuples at v. We then simply multiply these vectors together and add the terms of the result (in effect a multi-way dot product) to get the entry for the vertex tensor. (This description assumed there are no self-loops. If there are, either stick an equality relation in them to break the self-loop, or first process the self-loop as described above for eliminating a leaf cycle.)

We can see that any vertex and its edges (with their matrices) can be replaced by one big vertex tensor (and then applying the obvious semantics when using the tensor in the matrix network), and from the point of view of the rest of the network, nothing has changed.

Now we can say what would make a change-of-basis at some vertex a right or wrong

change: If the vertex tensor is changed, then it was a bad change. If the vertex tensor is unchanged, then the change of basis was a fine thing to do.

So how does our simple idea, of multiplying each matrix by the basis-change matrix M, fare? Well, the original vectors that were being collected from the neighbors (in the course of calculating an entry of the vertex tensor) are now multiplied by M before we take their multi-way dot product.

n

X

i=1

Yd

j=1

Xn

k=1

(Vj)kMk,i=? Xn

i=1

Yd

j=1

(Vj)i .

The first sum and product on each side compute the multi-way dot product. Vj is the vector collected from thejth neighbor. The inner sum on the left handles the multiplication by M. We would like to know what conditions M must satisfy so that this equality holds for any V. Clearly if M is an identity matrix, or even a permutation matrix, then the equality holds. Does this extend at least to orthonormal matrices (matrices which simply convert between differently oriented coordinate systems)? Our lack of familiarity with the multi-way dot product prevents an immediate answer. Let us examine it more closely.

Define the down product ↓ of a matrix to be the sum of the products of the entries in each column. So for example:





1 3 2 4 4 4 2 1 0





= 1·4·2 + 3·4·1 + 2·4·0 = 8 + 12 + 0 = 20 .

This is exactly the multi-way dot product discussed above, and now our question is, for what matricesM does the equation↓(N) =↓(N·M) hold for all matricesN (of appropriate dimension)? That is, what matrices can we multiply by without affecting the down product?

The answer can be found by doing simple algebra and expanding out all the terms on both sides of↓(N) =↓(N·M), and then grouping the terms according to the contributions from N. Then, since the equation should be an identity for all N, we can view each side as a polynomial in the elements of N, and the coefficients on both sides must match. It turns out that this gives us the simple requirement that, if there are k rows in N, then

the rows of M must be vectors mi such that the down product of any kof them (allowing repetition) must be zero, unless a single row was repeatedk times, in which case the down product must equal one. This is a generalization of the notion of an orthonormal matrix, which corresponds to the case k = 2. Since k is the number of neighbors of the relation being transformed, we see that only vertices of degree 2 can be safely transformed by an orthonormal transformation. For higher degrees we must leave the down-product criterion in that form.

Dalam dokumen Networks of Relations (Halaman 42-46)