46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
|
|
#ifndef PROJECT2_INC_GRAPH_HPP
|
|
#define PROJECT2_INC_GRAPH_HPP
|
|
|
|
#include <set> // set<int>.find()
|
|
#include <string> // string -- not used?
|
|
#include <vector> // vector<int>, vector<vector<int>
|
|
|
|
typedef std::vector<std::vector<int>> matrix;
|
|
|
|
class graph {
|
|
public:
|
|
// Constructors
|
|
graph () {}
|
|
// Initializers:
|
|
// Read a graph from a file
|
|
int read (std::string filename);
|
|
// Error codes given off by read ()
|
|
enum ERROR { INVALID_PROCESSES = 0b000001,
|
|
INVALID_RESOURCES = 0b000010,
|
|
INVALID_COUNTS = 0b000100,
|
|
INVALID_ROWS = 0b001000,
|
|
INVALID_COLUMNS = 0b010000,
|
|
INVALID_FILENAME = 0b100000 };
|
|
|
|
// check functions:
|
|
// is the graph...
|
|
bool reducible (); // ?
|
|
bool knotted (); // ?
|
|
|
|
|
|
// miscellaneous functions:
|
|
// print the graph
|
|
void print ();
|
|
bool DFS( int node, std::set<int>&visited, int parent );
|
|
bool detectKnot();
|
|
|
|
private:
|
|
int num_processes = 0;
|
|
int num_resources = 0;
|
|
std::vector<int> resource_counts;
|
|
matrix m; // Tell me, Mr. Anderson, what good is a phone call if you are unable to speak?
|
|
};
|
|
|
|
#endif // PROJECT2_INC_GRAPH_HPP
|