324_Book

Bss object when this module is linked practice

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

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

Unformatted text preview: om the stack. Your job is to address these problems and devise a transpose routine that runs as fast as possible. Homework Problem 6.33 [Category 4]: This assignment is an intriguing variation of Problem 6.32. Consider the problem of converting a directed graph into its undirected counterpart ¼ . The graph ¼ has an edge from vertex Ù to vertex Ú iff there is an edge from Ù to Ú or from Ú to Ù in the original graph . The graph is represented by its adjacency matrix as follows. If Æ is the number of vertices in then is an Æ ¢ Æ matrix and its entries are all either 0 or 1. Suppose the vertices of are named Ú¼ Ú½ Ú¾ ÚÆ ½ . Then is 1 if there is an edge from Ú to Ú and 0 otherwise. Observe, that the elements on the diagonal of an adjacency matrix are always 1 and that the adjacency matrix of an undirected graph is symmetric. This code can be written with a simple loop: 1 2 3 4 5 6 7 void col_convert(int *G, int dim) { int i, j; for (i = 0; i &lt; dim; i++) for (j = 0; j &lt; dim; j++) G[j*dim + i...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online