Fix includes, add attribution headers, remove unused constructor

This commit is contained in:
2022-04-22 21:41:19 -05:00
parent 952c318619
commit 710807dde7
6 changed files with 25 additions and 35 deletions

View File

@@ -1,27 +1,10 @@
#include <cstdlib>
#include <string>
#include <vector>
/* +-------------+---------+-----------------------+
| John Breaux | jab0910 | JohnBreaux@my.unt.edu |
+-------------+---------+-----------------------+
| Created 2022-04-17 |
+-----------------------------------------------+ */
#include "graph.hpp"
graph::graph (const int processes, const int resources) {
num_processes = processes;
num_resources = resources;
matrix.x = processes + resources;
matrix.y = matrix.x;
// Reserve correct number of entries to minimize reallocation
matrix.data.reserve(matrix.x);
for (int x = 0; x < matrix.x; x++) {
// Make a new x (vector<int>)
matrix.data.push_back({});
// Reserve correct number of entries
matrix.data[x].reserve(matrix.y);
for (int y = 0; y < matrix.y; y++) {
// Make a new y (int)
matrix.data[x].push_back({});
}
}
}
void graph::print () {
printf("np: %d\tnr: %d\n", num_processes, num_resources);
printf("resource_counts:\n"); for (auto e: resource_counts) printf("%d\t", e); printf("\n");

View File

@@ -4,9 +4,6 @@
+-------------+---------+-----------------------+
| Created 2022-04-16 |
+-----------------------------------------------+ */
#include <cstdio>
#include <string>
#include <vector>
#include "graph.hpp" // Graph reduction/Knot detection, struct adjmatrix
int main(int argc, char** argv) {

View File

@@ -1,8 +1,9 @@
//TODO: Include C file IO header (stdio.h? Whatever it is)
#include <iostream>
/* +-------------+---------+-----------------------+
| John Breaux | jab0910 | JohnBreaux@my.unt.edu |
+-------------+---------+-----------------------+
| Created 2022-04-17 |
+-----------------------------------------------+ */
#include <fstream>
#include <string>
#include <vector>
#include <regex>
#include "graph.hpp"

View File

@@ -1,6 +1,8 @@
#include <cstdlib>
#include <string>
#include <vector>
/* +-------------+---------+-----------------------+
| John Breaux | jab0910 | JohnBreaux@my.unt.edu |
+-------------+---------+-----------------------+
| Created 2022-04-22 |
+-----------------------------------------------+ */
#include "graph.hpp"
/* reducible: