psu-graph-matrix - / Programmer: / Program: / Date: /...

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

View Full Document Right Arrow Icon
// Programmer: Doug Hogan // Program: Demo Program for 2D Arrays Example // Date: July 30, 2008 // Description: This program defines an adjacency matrix representation of // the graph model of part of the PSU campus at // graph.jpg, // and allows the user to display how many edges (direct paths) // there are between any two vertices (buildings) #include <iostream> // for cin, cout, endl #include <string> // for string class using namespace std; int main () { string buildings[5]; // Labels for what buildings vertices represent int mapAdjacency[5][5]; // Adjacency matrix for the graph: // entry at i, j tells how many edges there // are from vertex i to vertex j int source; // Index of source vertex user desires int dest; // Index of destination vertex user desires // SET UP THE BUILDINGS MATRIX buildings[0] = "Library"; buildings[1] = "HUB"; buildings[2] = "Willard"; buildings[3] = "Old Main"; buildings[4] = "Hammond"; // SET UP THE ADJACENCY MATRIX
Background image of page 1

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

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

This document was uploaded on 02/10/2011.

Page1 / 2

psu-graph-matrix - / Programmer: / Program: / Date: /...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online