chap25-solutions

# chap25-solutions - Selected Solutions for Chapter 25...

This preview shows pages 1–2. Sign up to view the full content.

Selected Solutions for Chapter 25: All-Pairs Shortest Paths Solution to Exercise 25.1-3 The matrix L .0/ corresponds to the identity matrix I D NUL 1 0 0 ± ± ± 0 0 1 0 ± ± ± 0 0 0 1 ± ± ± 0 : : : : : : : : : : : : : : : 0 0 0 ± ± ± 1 ± of regular matrix multiplication. Substitute 0 (the identity for C ) for 1 (the iden- tity for min), and 1 (the identity for ± ) for 0 (the identity for C ). Solution to Exercise 25.1-5 The all-pairs shortest-paths algorithm in Section 25.1 computes L .n NUL 1/ D W n NUL 1 D L .0/ ± W n NUL 1 ; where l .n NUL 1/ ij D ı.i; j / and L .0/ is the identity matrix. That is, the entry in the i th row and j th column of the matrix “product” is the shortest-path distance from vertex i to vertex j , and row i of the product is the solution to the single-source shortest-paths problem for vertex i . Notice that in a matrix “product” C D A ± B , the i th row of C is the i th row of A “multiplied” by B . Since all we want is the i th row of C , we never need more than the i th row of A .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern