c340s01f

# c340s01f - CSc 340 Final Examination Monday 14 May 2001...

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

CSc 340 Final Examination Monday 14 May 2001 SUGGESTED ANSWERS 1. Below I give the adjacency matrix of a weighted, undirected graph. The nodes are a, b, c, d, . .., m. If there is no arc between two nodes, nothing is shown. If there is an arc between two nodes I list the weight of the arc. Note: Because the graph is undirected the matrix (should be) is symmetric. a b c d e f g h i j k l m a 1 3 4 4 b 1 2 4 5 c 2 3 3 2 d 3 4 2 4 e 4 1 1 5 f 1 1 1 5 g 1 1 1 1 h 3 1 1 3 i 4 4 4 j 3 2 2 k 1 1 4 l 1 1 2 m 4 5 2 4 5 5 1 3 4 2 4 2 Show each step as you use Prim's algorithm for finding a MINIMUM spanning tree for the graph of the above adjacency matrix. Tree Fringe(node,wt) a b(a,1),h(a,3),i(a,4),m(a,4) ab c(b,2),h(a,3),i(a,4),m(a,4) ab,bc m(c,2),h(a,3),d(c,3),j(c,3),i(a,4) ab,bc,cm g(m,1),j(m,2),l(m,2),h(a,3),d(c,3),i(a,4),k(m,4),e(m,5),

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

View Full Document
f(m,5) ab,bc,cm,mg f(g,1),h(g,1),l(g,1),j(m,2),d(c,3),i(a,4),k(m,4),e(m,5) ab,bc,cm,mg h(g,1),l(g,1),k(f,1),e(f,1),j(m,2),d(c,3),i(a,4) gf ab,bc,cm,mg l(g,1),k(f,1),e(f,1),j(m,2),d(c,3),i(a,4) gf,gh ab,bc,cm,mg k(f,1),e(f,1),j(m,2),d(c,3),i(a,4) gf,gh,gl ab,bc,cm,mg e(f,1),j(m,2),d(c,3),i(a,4) gf,gh,gl,fk ab,bc,cm,mg j(m,2),d(c,3),i(a,4) gf,gh,gl,fk, fe ab,bc,cm,mg d(j,2),i(a,4) gf,gh,gl,fk, fe,mj ab,bc,cm,mg i(a,4) gf,gh,gl,fk, fe,mj,jd ab,bc,cm,mg wt of tree is sum of wts of the nodes to the left gf,gh,gl,fk, = 1 + 2 + 2 + 1 + fe,mj,jd,ai 1 + 1 + 1 + 1 + 1 + 2 + 2 + 4 = 19 2. Show each step as you use Kruskal's algorithm for finding a MAXIMUM spanning tree for the graph of the adjacency matrix in problem 1. Set of Edge Sets Edge Q (wt) a b c d e f g h i j k l m bm(5),em(5),fm(5),ai(4),am(4),bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) a bm c d e f g h i j k l em(5),fm(5),ai(4),am(4),bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3),
bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) a bm,me c d f g h i j k l fm(5),ai(4),am(4),bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) a bm,me,mf c d g h i j k l ai(4),am(4),bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) ai bm,me,mf c d g h j k l am(4),bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) ai,am,bm,me,mf c d g h j k l bi(4),de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) ai,am,bm,me,mf c d g h j k l de(4), dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1) ai,am,bm,me,mf,ed c g h j k l dm(4),im(4),km(4),ah(3),cd(3),cj(3),hm(3), bc(2),cm(2),dj(2),jm(2),lm(2),ab(1),ef(1), ek(1),fg(1),fk(1),gh(1),gl(1),gm(1),hl(1)

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 ]}

### Page1 / 14

c340s01f - CSc 340 Final Examination Monday 14 May 2001...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online