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

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

View Full Document Right Arrow Icon
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 .
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern