4600-project-2/inc/graph.hpp

39 lines
876 B
C++
Raw Normal View History

2022-04-17 00:03:38 +00:00
#ifndef PROJECT2_GRAPH_HPP_INCLUDED
#define PROJECT2_GRAPH_HPP_INCLUDED
#include <string> // string
#include <vector> // vector<int>, vector<vector<int>
2022-04-18 03:03:17 +00:00
class graph {
public:
// Constructors
2022-04-22 23:48:36 +00:00
graph() {}
2022-04-18 03:03:17 +00:00
// Initializers:
// Read a graph from a file
2022-04-22 23:48:36 +00:00
void read(std::string filename);
// TODO: generate a random graph
void random(int processes, int resources);
2022-04-18 03:03:17 +00:00
// check functions:
// is the graph...
bool reducible();// ?
bool knotted();// ?
2022-04-22 23:48:36 +00:00
// miscellaneous functions:
// print the graph
void print ();
2022-04-22 23:48:36 +00:00
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