Finalize
This commit is contained in:
parent
e202443d84
commit
07820552d3
45
README.md
45
README.md
@ -2,6 +2,17 @@
|
||||
|
||||
Project 2 for CSCE4600, for Team G4
|
||||
|
||||
```
|
||||
╔════════════════╦══════════════════════════╗
|
||||
║ John Breaux ║ JohnBreaux@my.unt.edu ║
|
||||
║ Gabriel Castro ║ GabrielCastro@my.unt.edu ║
|
||||
║ Michael Laymon ║ MichaelLaymon@my.unt.edu ║
|
||||
╠════════════════╩══════════════════════════╣
|
||||
║ Created 2022-04-16 Updated 2022-04-28 ║
|
||||
╚═══════════════════════════════════════════╝
|
||||
```
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
Build with `make`
|
||||
@ -9,3 +20,37 @@ Build with `make`
|
||||
Run with `./main.out filename`
|
||||
|
||||
Clean with `make clean`
|
||||
|
||||
## Run
|
||||
|
||||
Run with `./main.out [input_f
|
||||
|
||||
## Analysis, Benefits and Drawbacks
|
||||
|
||||
### Analysis:
|
||||
- We implemented the Graph Reduction algorithm on adjacency matrices, with some minor optimizations:
|
||||
- By counting the number of remaining processes, and comparing it to the number of processes eliminated so far, we can detect when the algorithm has failed a single time, after which it'll fail forever.
|
||||
-
|
||||
|
||||
### Benefits:
|
||||
- The graph reduction algorithm is very elegant, but also easy to optimize
|
||||
- "Deleting" a node from an adjacency matrix can be performed by zeroing its respective row and column and re-running the algorithm, which is very simple!
|
||||
|
||||
### Drawbacks:
|
||||
- The adjacency matrix representation is used without interpretation, making the output somewhat hard to read
|
||||
- Our implementation of knot detection didn't pan out.
|
||||
|
||||
## Contributions:
|
||||
|
||||
### John Breaux:
|
||||
- src/graph.cpp, inc/graph.hpp (graph implementation)
|
||||
- src/main.cpp
|
||||
- src/read.cpp, inc/read.hpp (reading from graph)
|
||||
- src/reducible.cpp (graph reduction)
|
||||
- .clang-format
|
||||
- Makefile (Makefile)
|
||||
- Readme.md
|
||||
- Hosted the git repo
|
||||
|
||||
### Michael Laymon
|
||||
- knotted.cpp
|
18
src/main.cpp
18
src/main.cpp
@ -3,7 +3,7 @@
|
||||
║ Gabriel Castro ║ GabrielCastro@my.unt.edu ║
|
||||
║ Michael Laymon ║ MichaelLaymon@my.unt.edu ║
|
||||
╠════════════════╩══════════════════════════╣
|
||||
║ Created 2022-04-16 Updated 2022-04-23 ║
|
||||
║ Created 2022-04-16 Updated 2022-04-28 ║
|
||||
╚═══════════════════════════════════════════╝ */
|
||||
|
||||
#include <string>
|
||||
@ -11,10 +11,14 @@
|
||||
#include "graph.hpp" // graph, Graph reduction/Knot detection
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
//? Command line argument structure?
|
||||
//? Other flags? What other features should this have?
|
||||
if (argc < 2) return 1;
|
||||
// If not enough arguments, print usage
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s [filename]", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
// Grab the filename from args
|
||||
std::string filename = argv[1];
|
||||
// Construct a graph
|
||||
graph g;
|
||||
|
||||
// Read from a file, and print the result
|
||||
@ -24,8 +28,8 @@ int main (int argc, char **argv) {
|
||||
}
|
||||
g.print ();
|
||||
// Graph reduction
|
||||
printf ("Graph is %s\n", g.reducible () ? "not reducible! Deadlock!" : "reducible! No deadlock!");
|
||||
// Knot detection
|
||||
printf ("Graph is %s\n", g.knotted () ? "knotted! Deadlock!" : "not! No deadlock!");
|
||||
printf ("Graph is %s\n\n", g.reducible () ? "not reducible! Deadlock!" : "reducible! No deadlock!");
|
||||
// Knot detection (broken. Algorithm isn't right)
|
||||
// printf ("Graph is %s\n\n", g.knotted () ? "knotted! Deadlock!" : "not knotted! No deadlock!");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user