39 lines
876 B
C++
39 lines
876 B
C++
|
|
#ifndef PROJECT2_GRAPH_HPP_INCLUDED
|
|
#define PROJECT2_GRAPH_HPP_INCLUDED
|
|
|
|
#include <string> // string
|
|
#include <vector> // vector<int>, vector<vector<int>
|
|
|
|
class graph {
|
|
public:
|
|
// Constructors
|
|
graph() {}
|
|
// Initializers:
|
|
// Read a graph from a file
|
|
void read(std::string filename);
|
|
// TODO: generate a random graph
|
|
void random(int processes, int resources);
|
|
// check functions:
|
|
// is the graph...
|
|
bool reducible();// ?
|
|
bool knotted();// ?
|
|
|
|
// miscellaneous functions:
|
|
// print the graph
|
|
void print ();
|
|
|
|
struct m{
|
|
int x, y;
|
|
std::vector<std::vector<int>> data;
|
|
};
|
|
|
|
private:
|
|
int num_processes = 0;
|
|
int num_resources = 0;
|
|
std::vector<int> resource_counts;
|
|
struct m matrix; // Tell me, Mr. Anderson, what good is a phone call if you are unable to speak?
|
|
bool is_blocked(int process_id);
|
|
};
|
|
|
|
#endif |