hwk9 - Fall 2011 CMSC 351: Homework 9 Clyde Kruskal Due at...

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: Fall 2011 CMSC 351: Homework 9 Clyde Kruskal Due at the start of class Wednesday, November 16, 2011. Problem 1. The square of a directed graph G = ( V,E ) is the graph G 2 = ( V,E 2 ) such that ( x,y ) ∈ E 2 if and only if for some z ∈ V , both ( x,z ) ∈ E and ( z,y ) ∈ E . That is, G 2 contains an edge between x and y whenever G contains a path with exactly two edges between x and y . (a) Describe an efficient algorithm for computing G 2 from G using the adjacency matrix representation of G . Analyze its efficiency. (b) Describe an efficient algorithm for computing G 2 from G using the adjacency list representation of G . Analyze its efficiency. Problem 2. Assume that a list of vertices represents a directed (not necessarily simple) cycle where the last vertex of the array has an edge to the first vertex. Assume you have two cycles in a (directed) graph G = ( V,E ), represented by two arrays A and B , where the two cyces do not share any edges but do intersect (at at least one...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

Ask a homework question - tutors are online