BFS (Project 2)

BFS (Project 2) - #include #include ...

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

View Full Document Right Arrow Icon
#include <iostream> #include <fstream> #include <string> #include <queue> #define INFINITY -1 using namespace std; // Structure declaration struct holder { int currentNode; int totalNodes; string color[200]; int e[200]; int pred[200]; bool tree[200][200]; bool cross[200][200]; bool back[200][200]; bool directed; }; // Function prototype holder BFSFunc(holder a, int g[200][200]); int main () { // Declare counting variables int i; int j; int directed; int numNodes; int nodeNumber; int numResources; int numOperations; int operationNum; int clockValue; char fileName[200]; // Get name of graph file cout << "Please enter name of graph input file: ";
Background image of page 1

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

View Full DocumentRight Arrow Icon
cin >> fileName; // ------- Begin Reading Graph Input File -------- ifstream graphInput; graphInput.open(fileName, ios::in); graphInput >> directed; graphInput >> numNodes; int operationType[200]; int outEdges[200]; int edgeConnect[200][200]; for (i = 0; i < 200; i++) { for (j = 0; j < 200; j++) { edgeConnect[i][j] = 0; } } for (i = 0; i < numNodes; i++) { graphInput >> nodeNumber; graphInput >> operationType[nodeNumber]; graphInput >> outEdges[nodeNumber]; for (j = 0; j < outEdges[i]; j++) { graphInput >> edgeConnect[nodeNumber][j]; } } graphInput.close();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/20/2008 for the course EE 4702 taught by Professor Ramanujam during the Spring '08 term at LSU.

Page1 / 7

BFS (Project 2) - #include #include ...

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

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