2022-04-17 00:03:38 +00:00
|
|
|
|
2022-04-23 22:56:41 +00:00
|
|
|
#ifndef PROJECT2_INC_GRAPH_HPP
|
|
|
|
#define PROJECT2_INC_GRAPH_HPP
|
2022-04-23 02:41:19 +00:00
|
|
|
|
|
|
|
#include <string> // string
|
|
|
|
#include <vector> // vector<int>, vector<vector<int>
|
|
|
|
|
2022-04-23 22:56:41 +00:00
|
|
|
typedef std::vector<std::vector<int>> matrix;
|
|
|
|
|
2022-04-18 03:03:17 +00:00
|
|
|
class graph {
|
2022-04-23 22:56:41 +00:00
|
|
|
public:
|
2022-04-18 03:03:17 +00:00
|
|
|
// Constructors
|
2022-04-23 22:56:41 +00:00
|
|
|
graph () {}
|
2022-04-18 03:03:17 +00:00
|
|
|
// Initializers:
|
2022-04-23 02:08:33 +00:00
|
|
|
// Read a graph from a file
|
2022-04-23 22:56:41 +00:00
|
|
|
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 };
|
2022-04-23 09:47:55 +00:00
|
|
|
|
2022-04-18 03:03:17 +00:00
|
|
|
// check functions:
|
|
|
|
// is the graph...
|
2022-04-23 22:56:41 +00:00
|
|
|
bool reducible (); // ?
|
|
|
|
bool knotted (); // ?
|
2022-04-22 23:48:36 +00:00
|
|
|
|
2022-04-23 02:08:33 +00:00
|
|
|
// miscellaneous functions:
|
|
|
|
// print the graph
|
|
|
|
void print ();
|
|
|
|
|
2022-04-23 22:56:41 +00:00
|
|
|
private:
|
2022-04-22 23:48:36 +00:00
|
|
|
int num_processes = 0;
|
|
|
|
int num_resources = 0;
|
|
|
|
std::vector<int> resource_counts;
|
2022-04-23 09:47:55 +00:00
|
|
|
matrix m; // Tell me, Mr. Anderson, what good is a phone call if you are unable to speak?
|
2022-04-23 02:41:19 +00:00
|
|
|
};
|
|
|
|
|
2022-04-23 22:56:41 +00:00
|
|
|
#endif // PROJECT2_INC_GRAPH_HPP
|