• Aucun résultat trouvé

Path Algebras

Dans le document Algorithms and Computation in Mathematics • (Page 110-116)

Shortest Paths

3.11 Path Algebras

Let (G, w) be a network without cycles of negative length. According to Bellman’s equations (Proposition 3.5.1), the distances ui with respect to a vertexithen satisfy the conditions

(B) u1= 0 and ui= min{uk+wki:i=k} fori= 2, . . . , n.

In this section, we consider the question whether such a system of equations might be solved using methods from linear algebra. In fact, this is possible by introducing appropriate algebraic structures calledpath algebras. We only sketch the basic ideas here; for details we refer to the literature, in particular [Car71, Car79, GonMi84, Zim81].10

10This section is included just to provide some more theoretical background. As it will not be used in the rest of the book, it may be skipped.

98 3 Shortest Paths

We begin with a suitable transformation of the system (B). Recall that we put wij= if ij is not an edge of our network; therefore we extend R to

since (G, w) does not contain any cycles of negative length. Using the oper-ations introduced above, we get the system of equoper-ations

B and apply the operationsandto them in analogy to the usual definitions from linear algebra. Then (B) (and hence (B)) can be written as a linear system of equations:

B

u=u∗W⊕b,

whereu= (u1, . . . , un), b= (0,∞, . . . ,∞) andW = (wij)i,j=1,...,n.

Thus Bellman’s equations may be viewed as a linear system of equations over the algebraic structure (R,⊕,∗). Then the algorithm of Bellman and Ford given in Exercise3.7.10admits the following interpretation. First set

u(0)=b and then recursively u(k)=u(k1)∗W ⊕b,

until the sequence eventually converges to u(k)=u(k1), which in our case occurs for k=n or earlier. Hence the algorithm of Bellman and Ford is analogous to the Jacobi method from classical linear algebra overR; see, for instance, [Str88].

These observations lead to studying algebraic structures which satisfy the same conditions as (R,⊕,∗). A path algebra or dioid is a triple (R,⊕,∗) such that (R,) is a commutative monoid, (R,) is a monoid, and both distributive laws hold; moreover, the neutral elementoof (R,) satisfies the absorption law. This means that the following axioms hold, whereedenotes the neutral element for (R,):

(1) a⊕b=b⊕a;

(2) a⊕(b⊕c) = (a⊕b)⊕c;

(3) a⊕o=a;

(4) a∗o=o∗a=o;

(5) a∗e=e∗a=a;

(6) a∗(b∗c) = (a∗b)∗c;

(7) a∗(b⊕c) = (a∗b)⊕(a∗c);

(8) (b⊕c)∗a= (b∗a)⊕(c∗a).

Exercise 3.11.1 Show that (R,⊕,∗) is a path algebra withe= 0 ando=. Exercise 3.11.2 Let (R,⊕,∗) be a path algebra. We define a relationon Rby

ab ⇐⇒ a=b⊕c for some c∈R.

Show that is a preordering (that is, it is reflexive and transitive). If is idempotent (that is,a⊕a=afor alla∈R), thenis even a partial ordering (that is, it is also antisymmetric).

Exercise 3.11.3 Let (G, w) be a network without cycles of negative length.

Give a matrix equation for the distance matrixD= (d(i, j)).

We now transfer the notions developed in the special case of (R,⊕,∗) to arbitrary path algebras. For the remainder of this section, anetwork means a pair (G, w) such that Gis a digraph, w:E→R is a length function, and (R,⊕,∗) is a path algebra. Thelengthof a pathP= (v0, v1, . . . , vn) is defined as

w(P) :=w(v0v1)∗w(v1v2)∗ · · · ∗w(vn1vn).

TheAP-problem (short for algebraic path problem) requires calculating the sums

wij=⊕w(P) (wherePis a directed path fromitoj)

and finding a path P from i to j such that w(P) =wij (if the above sum and such a path exist). For the case (R,⊕,∗), the AP-problem reduces to the familiarSP-problem (shortest path problem) of determining the distances and shortest paths.

As before, we introduce a matrixW = (wij) whose (i, j)-entry is the length w(ij) if ij is an edge of G. We set wii=o for i= 1, . . . , n and wij =o if i=j and ij is not an edge in G. Note that, for the special case (R,⊕,∗) above, we looked at the matrixW=W⊕E; see Exercise3.11.5below. Here E denotes the unit matrix, that is, eii=e for i= 1, . . . , n and eij =o for i=j. As usual, we write Ak for the k-th power of A; moreover, we define A(k):=E⊕A⊕A2⊕ · · · ⊕Ak.

Lemma 3.11.4 The (i, j)-entry of the matrix Wk or of W(k) is the sum

⊕w(P) over all directed walks from i toj consisting of exactlyk edges for the former, and of at most k edges for the latter.

100 3 Shortest Paths

Proof Use induction onk.

We look again at the special case of the SP-problem. In a network (G, w) not containing cycles of negative length, distances can always be realized by paths, so that we need at mostn−1 edges. Thus we have D=W(n1); moreover,W(n1)=W(n)=· · ·. It is easy to see thatW(n1)indeed satisfies the matrix equation given in the solution to Exercise3.11.3:

W(n1)∗W⊕E=

E⊕W⊕ · · · ⊕Wn1

∗W⊕E

=E⊕W⊕ · · · ⊕Wn1⊕Wn=W(n)=W(n1). An element a with a(p)=a(p+1) for some p is called a stable element; this notion is important also for general path algebras. In fact, the matrixW= (wij) of the AP-problem is an infinite sum⊕Wk=E⊕W⊕W2⊕. . ., that is, it is thelimit of the matricesW(k)fork→ ∞. IfW is stable, these formulas make sense: if W(p)=W(p+1), then W=W(p). That is the reason why criteria for stability play an important part in the theory of path algebras;

see [Zim81]. For the theory of convergence, see also [KuiSa86].

Exercise 3.11.5 Let (R,⊕,∗) be a path algebra such thatis idempotent.

For every matrixA, we putA:=E⊕A. Show (A)k=A(k)and use this fact to find a technique for calculatingA(n); also discuss its complexity.

Now suppose that W is stable; we call W=W(p)=W(p+1) the quasi-inverse ofW. As in the special caseR=Rabove, we have

W=W∗W ⊕E=W∗W⊕E.

Thus, for an arbitrary matrixB, the matricesY :=W∗BandZ:=B∗W, respectively, are solutions of the equations

Y =W∗Y ⊕B and Z=Z∗W⊕B. (3.8) In particular, we can choose a column or row vector b for B and obtain a linear system of equations analogous to the system (B).

Exercise 3.11.6 Let (R,⊕,∗) be an arbitrary path algebra. Show that the (n×n)-matrices over R also form a path algebra and define a preordering (or, in the idempotent case, a partial ordering) on this path algebra; see Exercise 3.11.2. Prove that W∗B and B∗W are minimal solutions of equation (3.8) and that the system (3.8) has a unique minimal solution in the idempotent case.

Equations having the same form as (3.8) can be solved using techniques analogous to the well-known methods of linear algebra over R. We have al-ready seen that the algorithm of Bellman and Ford corresponds to the Jacobi

method; this technique can also be used for the general case of a stable matrix W over any path algebra R. Similarly, it can be shown that the algorithm of Floyd and Warshall corresponds to the Gauss-Jordan elimination method.

For more on this result and other general algorithms for solving (3.8), we refer to [GonMi84] and [Zim81].

We conclude this section with some examples which will show that the abstract concept of path algebras makes it possible to treat various interesting network problems with just one general method. However, the SP-problem is still the most important example; here the case of positive lengths—that is, the path algebra (R+,min,+)—was already studied by [Shi75]. Similarly, longest paths can be treated using the path algebra (R∪ {−∞},max,+) instead.

Example 3.11.7 Consider the path algebra ({0,1},max,min)—that is, the Boolean algebra on two elements—and putwij= 1 for each edge ofG. Then Lemma3.11.4 has the following interpretation. There exists a directed walk from i to j consisting of exactly k edges if and only if the (i, j)-entry of Wk is 1, and of at most k edges if and only if the (i, j)-entry ofW(k) is 1.

Moreover, the matrixW=W(n1)is the adjacency matrix of the transitive closure ofG; see Exercise3.9.6.

Example 3.11.8 Consider the path algebra (R+,max,min) and think of the lengthw(ij) of an edge ij as its capacity. Thenw(P) is thecapacity of the pathP; that is,w(P) is the minimum of the capacities of the edges contained in P. Here the (i, j)-entry of Wk is the largest capacity of a walk from i to j with exactly k edges, while for W(k) it is the largest capacity of a walk fromitoj with at mostkedges. HenceW=W(n1)andwij is the largest capacity of a walk fromi toj; see [Hu61].

Example 3.11.9 Consider the path algebra (N0,+,·), where each edge of G has lengthw(ij) = 1. ThenW is just the adjacency matrix ofG. The (i, j)-entry ofWk and ofW(k)represent the number of walks fromitojconsisting respectively of precisely and at mostk edges; see Exercise 2.2.5. Note that W does not exist in general, as there might be infinitely many walks fromi toj. IfGis an acyclic digraph,W is well-defined; in this caseW=W(n1) andwij is the number of all directed walks from ito j.

Exercise 3.11.10 Find a path algebra which is suitable for treating the problem of Example 3.1.2, where w(i, j) is the probability p(i, j) described in Example3.1.2; see [Kal60].

Exercise 3.11.11 Any commutative field (K,+,·) is obviously also a path algebra. Show thatA is stable overK ifGis acyclic, and give a formula for A under this condition. Does the converse hold?

102 3 Shortest Paths

The reader can find a lot of further examples for path algebras in the literature quoted above, in particular in [GonMi84] and in [Zim81]; see also [KuiSa86] for applications in automata theory. Finally, let us also mention a practical example from operations research.

Example 3.11.12 We construct a digraph G whose vertices are the single parts, modules, and finished products occurring in an industrial process. We want the edges to signify how many single parts or intermediary modules are needed for assembling bigger modules or finished products. That is, we assign weightw(i, j) to edge ij if we need w(i, j) units of parti for assem-bling productj.Gis called thegozinto graph. In most cases, the modules and products are divided into levels of the same rank, where the finished products have highest rank, and basic parts (which are not assembled from any smaller parts) lowest rank; that is, the products and modules are divided into dispo-sition levels. The notion of ranks used here is the same as in Exercise3.6.3;

it can be calculated as in Exercise3.6.4. Often the gozinto graph is taken to be reduced in the sense of Sect.3.9, that is, it contains an edgeij only if part i is used directly in assembling module j, without any intermediate steps.

Note that the reduced graphGredcan be determined as in Exercise3.9.7, as we always assumeGto be acyclic.11

Now suppose that we have a gozinto graph which is reduced already. Some-times one wants to know how much of each part is needed, no matter whether directly or indirectly. For this purpose, we consider the path algebra (N0,+,·) and the given weightsw(ij). AsGis acyclic, there are only finitely many di-rected paths from vertexito vertexj; thus the matrixW(=W(n1)) exists.

Now it is easily seen that the entrywij is just the total number of units of i needed for the assembly of j. The matrix W may, for example, be de-termined using the algorithm of Bellman and Ford—that is, the generalized Jacobi method—or the analogue of the algorithm of Floyd and Warshall;

see [Mul69].

More about gozinto graphs can be found in the book by M¨uller-Merbach [Mul73] as well as in his two papers already cited. Note that the entries of a column of W give the numbers of parts and modules needed for the corresponding product, whereas the entries in the rows show where (and how much of) the corresponding part or module is needed.

11This assumption does not always hold in practice. For instance, gozinto graphs containing cycles are quite common in chemical production processes; see [Mul66].

Dans le document Algorithms and Computation in Mathematics • (Page 110-116)