4600-project-2/inc/graph.hpp

46 lines
1.2 KiB
C++
Raw Permalink Normal View History

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
#include <set> // set<int>.find()
#include <string> // string -- not used?
#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:
// 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
// miscellaneous functions:
// print the graph
void print ();
bool DFS( int node, std::set<int>&visited, int parent );
bool detectKnot();
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?
};
#endif // PROJECT2_INC_GRAPH_HPP