Docsity

Weighted Graphs, Modified Adjacency Matrix - Notes | CPSC 5157U, Study notes of Computer Systems Networking and Telecommunications

Partial preview of the text

Download Weighted Graphs, Modified Adjacency Matrix - Notes | CPSC 5157U and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

Weighted Graphs

Here is the book’s figure. u x y v w z 2 2 1 3 1 1 2 5 3 5 uu xx yy vv ww zz 2 2 1 3 1 1 2 5 3 5 Represented as a weighted graph in standard notation, we have G = (N, E) N = { u, v, w, x, y, z } E = { (u, v, 2), (u, w, 5), (u, x, 1), (v, x, 2), (v, w, 3), (w, x, 3),(w, y, 1), (w, z, 5), (x, y, 1), (y, z, 2) }

Modified Adjacency Matrix

Here is the book’s figure. u x y v w z 2 2 1 3 1 1 2 5 3 5 uu xx yy vv ww zz 2 2 1 3 1 1 2 5 3 5 Here is an adjacency matrix representation of the graph. u v w x y z u 0 2 5 1 v 2 0 3 2 w 5 3 0 3 1 5 x 1 2 3 0 1 y 1 1 0 2 z 5 2 0

Modified Adjacency Matrix

Here is the book’s figure. u x y v w z 2 2 1 3 1 1 2 5 3 5 uu xx yy vv ww zz 2 2 1 3 1 1 2 5 3 5 Here is an adjacency matrix representation of the graph. u v w x y z u 0 2 5 1 100 100 v 2 0 3 2 100 100 w 5 3 0 3 1 5 x 1 2 3 0 1 108 y 100 100 1 1 0 2 z 100 100 5 100 2 0

Distance Vector

The distance from one node to another is the minimum of the sums of the weights over all paths between the two nodes. By inspection, we have the following shortest paths u to u 0 (by definition) u to v 2 u to w 3 (u  x  y  w) u to x 1 u to y 2 u to z 4 (u  x  y  z) The distance vector for node u is Du = ( 0, 2, 3, 1, 2, 4)