Implement Graph
Implement Graph algorithm based on the starter code provided and test your algorithms on multiple graphs.You must implement all the public functions in the starter code. You can (and should) write private functions to support the public functions. Some of the critical functions are:
- Constructors: Graph()
- Destructor: ~Graph()
- Helpers: contains, verticesSize, edgesSize, vertexDegree, getEdgesAsString
- Modifiers: add, connect, disconnect, readFile
- Algorithms: dfs, bfs, dijkstra, mstPrim
Run ./create-output.sh > output.txt 2>&1 and examine the output.txt file for any issues that need fixing
__MACOSX/._2022win343d-graph-samsyl916
2022win343d-graph-samsyl916/runit.sh
#!/bin/bash # shortcut to compile and run the program rm -f a.out g++ -g -std=c++11 -Wall -Wextra -Wno-sign-compare *.cpp ./a.out
2022win343d-graph-samsyl916/graph.cpp
#include "graph.h" #include <algorithm> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <utility> #include <vector> using namespace std; // constructor, empty graph // directionalEdges defaults to true Graph::Graph(bool directionalEdges) {} // destructor Graph::~Graph() {} // @return total number of vertices int Graph::verticesSize() const { return 0; } // @return total number of edges int Graph::edgesSize() const { return 0; } // @return number of edges from given vertex, -1 if vertex not found int Graph::vertexDegree(const string &label) const { return 0; } // @return true if vertex added, false if it already is in the graph bool Graph::add(const string &label) { return true; } /** return true if vertex already in graph */ bool Graph::contains(const string &label) const { return true; } // @return string representing edges and weights, "" if vertex not found // A-3->B, A-5->C should return B(3),C(5) string Graph::getEdgesAsString(const string &label) const { return ""; } // @return true if successfully connected bool Graph::connect(const string &from, const string &to, int weight) { return true; } bool Graph::disconnect(const string &from, const string &to) { return true; } // depth-first traversal starting from given startLabel void Graph::dfs(const string &startLabel, void visit(const string &label)) {} // breadth-first traversal starting from startLabel void Graph::bfs(const string &startLabel, void visit(const string &label)) {} // store the weights in a map // store the previous label in a map pair<map<string, int>, map<string, string>> Graph::dijkstra(const string &startLabel) const { map<string, int> weights; map<string, string> previous; // TODO(student) Your code here return make_pair(weights, previous); } // minimum spanning tree using Prim's algorithm int Graph::mstPrim(const string &startLabel, void visit(const string &from, const string &to, int weight)) const { return -1; } // minimum spanning tree using Prim's algorithm int Graph::mstKruskal(const string &startLabel, void visit(const string &from, const string &to, int weight)) const { return -1; } // read a text file and create the graph bool Graph::readFile(const string &filename) { ifstream myfile(filename); if (!myfile.is_open()) { cerr << "Failed to open " << filename << endl; return false; } int edges = 0; int weight = 0; string fromVertex; string toVertex; myfile >> edges; for (int i = 0; i < edges; ++i) { myfile >> fromVertex >> toVertex >> weight; connect(fromVertex, toVertex, weight); } myfile.close(); return true; }
2022win343d-graph-samsyl916/graphtest.cpp
2022win343d-graph-samsyl916/graphtest.cpp
/**
* Testing BST - Binary Search Tree functions
*
* @author Yusuf Pisan
* @date 19 Oct 2019
*/
#include "graph.h"
#include < cassert >
#include < iostream >
#include < sstream >
#include < string >
using namespace std ;
// global value for testing
// NOLINTNEXTLINE
stringstream globalSS ;
// need to reset SS before calling this
void vertexPrinter ( const string & s ) { globalSS << s ; }
// need to reset SS before calling this
void edgePrinter ( const string & from , const string & to , int weight ) {
globalSS << "[" << from << to << " " << weight << "]" ;
}
// convert a map to a string so we can compare it
template < typename K , typename L >
static string map2string ( const map < K , L > & mp ) {
stringstream out ;
for ( auto & p : mp ) {
out << "[" << p . first << ":" << p . second << "]" ;
}
return out . str ();
}
void testGraphBasic () {
Graph g ;
assert ( g . add ( "a" ) && "add vertex a" );
assert ( g . add ( "b" ) && "add vertex b" );
assert ( g . add ( "c" ) && "add vertex c" );
assert ( g . add ( "d" ) && "add vertex d" );
assert ( g . add ( "e" ) && "add vertex e" );
assert ( ! g . add ( "b" ) && "b added twice" );
assert ( g . connect ( "a" , "b" , 10 ) && "connect a b" );
assert ( ! g . connect ( "a" , "b" , 50 ) && "duplicate connect a b" );
assert ( ! g . connect ( "a" , "a" , 1 ) && "connect a to itself" );
g . connect ( "a" , "d" , 40 );
g . connect ( "a" , "c" , 20 );
assert (( g . verticesSize () == 5 ) && "graph number of vertices" );
assert (( g . edgesSize () == 3 ) && "graph number of edges" );
assert (( g . vertexDegree ( "a" ) == 3 ) && "vertex number of edges" );
assert (( g . vertexDegree ( "c" ) == 0 ) && "no outgoing edges c" );
assert (( g . vertexDegree ( "xxx" ) == - 1 ) && "no edges for xxx" );
assert ( ! g . contains ( "xxx" ) && "xxx not in graph" );
assert ( g . contains ( "a" ) && "a in graph" );
// check that they are sorted based on edge end label
assert ( g . getEdgesAsString ( "a" ) == "b(10),c(20),d(40)" );
// disconnect non-existent edge/vertex
assert ( ! g . disconnect ( "a" , "e" ) && "disconnecting non-existent vertex" );
assert (( g . edgesSize () == 3 ) && "disconnected nonexisting" );
assert ( g . disconnect ( "a" , "c" ) && "a-c disconnect" );
assert (( g . edgesSize () == 2 ) && "number of edges after disconnect" );
assert (( g . vertexDegree ( "a" ) == 2 ) && "a has 2 edges" );
assert ( g . getEdgesAsString ( "a" ) == "b(10),d(40)" && "removing middle edge" );
}
void testGraph0DFS () {
cout << "testGraph0DFS" << endl ;
Graph g ;
if ( ! g . readFile ( "graph0.txt" )) {
return ;
}
assert ( g . contains ( "A" ) && "a in graph" );
assert ( g . contains ( "B" ) && "b in graph" );
assert ( g . contains ( "C" ) && "c in graph" );
assert ( g . getEdgesAsString ( "A" ) == "B(1),C(8)" );
assert ( g . getEdgesAsString ( "B" ) == "C(3)" );
assert ( g . getEdgesAsString ( "C" ). empty ());
g . dfs ( "A" , vertexPrinter );
assert ( globalSS . str () == "ABC" && "starting from A" );
globalSS . str ( "" );
g . dfs ( "B" , vertexPrinter );
assert ( globalSS . str () == "BC" && "starting from B" );
globalSS . str ( "" );
g . dfs ( "C" , vertexPrinter );
assert ( globalSS . str () == "C" && "starting from C" );
globalSS . str ( "" );
g . dfs ( "X" , vertexPrinter );
assert ( globalSS . str (). empty () && "starting from X" );
}
void testGraph0BFS () {
cout << "testGraph0BFS" << endl ;
Graph g ;
if ( ! g . readFile ( "graph0.txt" )) {
return ;
}
globalSS . str ( "" );
g . bfs ( "A" , vertexPrinter );
assert ( globalSS . str () == "ABC" && "starting from A" );
globalSS . str ( "" );
g . dfs ( "B" , vertexPrinter );
assert ( globalSS . str () == "BC" && "starting from B" );
globalSS . str ( "" );
g . dfs ( "C" , vertexPrinter );
assert ( globalSS . str () == "C" && "starting from C" );
globalSS . str ( "" );
g . dfs ( "X" , vertexPrinter );
assert ( globalSS . str (). empty () && "starting from X" );
}
void testGraph0Dijkstra () {
cout << "testGraph0Dijkstra" << endl ;
Graph g ;
if ( ! g . readFile ( "graph0.txt" )) {
return ;
}
map < string , int > weights ;
map < string , string > previous ;
tie ( weights , previous ) = g . dijkstra ( "A" );
// cout << "Dijkstra(A) weights is " << map2string(weights) << endl;
assert ( map2string ( weights ) == "[B:1][C:4]" && "Dijkstra(A) weights" );
// cout << "Dijkstra(A) previous is " << map2string(previous) << endl;
assert ( map2string ( previous ) == "[B:A][C:B]" && "Dijkstra(A) previous" );
tie ( weights , previous ) = g . dijkstra ( "B" );
assert ( map2string ( weights ) == "[C:3]" && "Dijkstra(B) weights" );
assert ( map2string ( previous ) == "[C:B]" && "Dijkstra(B) previous" );
tie ( weights , previous ) = g . dijkstra ( "X" );
assert ( map2string ( weights ). empty () && "Dijkstra(C) weights" );
assert ( map2string ( previous ). empty () && "Dijkstra(C) previous" );
}
void testGraph0NotDirected () {
cout << "testGraph0NotDirected" << endl ;
bool isDirectional = false ;
Graph g ( isDirectional );
if ( ! g . readFile ( "graph0.txt" )) {
return ;
}
globalSS . str ( "" );
g . bfs ( "A" , vertexPrinter );
assert ( globalSS . str () == "ABC" && "starting from A" );
globalSS . str ( "" );
g . dfs ( "B" , vertexPrinter );
assert ( globalSS . str () == "BAC" && "starting from B" );
globalSS . str ( "" );
g . dfs ( "C" , vertexPrinter );
assert ( globalSS . str () == "CAB" && "starting from C" );
globalSS . str ( "" );
g . dfs ( "X" , vertexPrinter );
assert ( globalSS . str (). empty () && "starting from X" );
map < string , int > weights ;
map < string , string > previous ;
tie ( weights , previous ) = g . dijkstra ( "A" );
// cout << "Dijkstra(A) weights is " << map2string(weights) << endl;
assert ( map2string ( weights ) == "[B:1][C:4]" && "Dijkstra(A) weights" );
// cout << "Dijkstra(A) previous is " << map2string(previous) << endl;
assert ( map2string ( previous ) == "[B:A][C:B]" && "Dijkstra(A) previous" );
tie ( weights , previous ) = g . dijkstra ( "B" );
assert ( map2string ( weights ) == "[A:1][C:3]" && "Dijkstra(B) weights" );
assert ( map2string ( previous ) == "[A:B][C:B]" && "Dijkstra(B) previous" );
tie ( weights , previous ) = g . dijkstra ( "X" );
assert ( map2string ( weights ). empty () && "Dijkstra(C) weights" );
assert ( map2string ( previous ). empty () && "Dijkstra(C) previous" );
globalSS . str ( "" );
int mstLength = g . mstPrim ( "A" , edgePrinter );
assert ( mstLength == 4 && "mst A is 4" );
assert ( globalSS . str () == "[AB 1][BC 3]" && "mst A is [AB 1][BC 3]" );
globalSS . str ( "" );
mstLength = g . mstPrim ( "B" , edgePrinter );
assert ( mstLength == 4 && "mst 4 is 4" );
assert ( globalSS . str () == "[BA 1][BC 3]" );
globalSS . str ( "" );
mstLength = g . mstPrim ( "C" , edgePrinter );
assert ( mstLength == 4 && "mst C is 4" );
assert ( globalSS . str () == "[CB 3][BA 1]" );
globalSS . str ( "" );
mstLength = g . mstPrim ( "X" , edgePrinter );
assert ( mstLength == - 1 && "mst X is -1" );
assert ( globalSS . str (). empty () && "mst for vertex not found" );
}
void testGraph1 () {
cout << "testGraph1" << endl ;
Graph g ;
if ( ! g . readFile ( "graph1.txt" )) {
return ;
}
globalSS . str ( "" );
g . dfs ( "A" , vertexPrinter );
assert ( globalSS . str () == "ABCDEFGH" && "dfs starting from A" );
globalSS . str ( "" );
g . bfs ( "A" , vertexPrinter );
assert ( globalSS . str () == "ABHCGDEF" && "bfs starting from A" );
globalSS . str ( "" );
g . dfs ( "B" , vertexPrinter );
assert ( globalSS . str () == "BCDEFG" && "dfs starting from B" );
globalSS . str ( "" );
g . bfs ( "B" , vertexPrinter );
assert ( globalSS . str () == "BCDEFG" && "bfs starting from B" );
map < string , int > weights ;
map < string , string > previous ;
auto p = g . dijkstra ( "A" );
weights = p . first ;
previous = p . second ;
assert ( map2string ( weights ) == "[B:1][C:2][D:3][E:4][F:5][G:4][H:3]" &&
"Dijkstra(B) weights" );
assert ( map2string ( previous ) == "[B:A][C:B][D:C][E:D][F:E][G:H][H:A]" &&
"Dijkstra(B) previous" );
}
void testAll () {
testGraphBasic ();
testGraph0DFS ();
testGraph0BFS ();
testGraph0Dijkstra ();
testGraph0NotDirected ();
testGraph1 ();
}
2022win343d-graph-samsyl916/.clang-tidy
# Configuration options for clang-tidy # CSS Linux machines, Sep 2019: LLVM version 3.8.1 # # usage: clang-tidy *.cpp — -std=c++14 # # — # See https://clang.llvm.org/extra/clang-tidy/#using-clang-tidy for all possible checks Checks: '*,-fuchsia-*,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-google-build-using-namespace,-hicpp-no-array-decay,-modernize-use-trailing-return-type,-llvm-header-guard,-cert-err60-cpp,-cppcoreguidelines-pro-bounds-constant-array-index,-google-global-names-in-headers,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,cppcoreguidelines-avoid-c-arrays,-google-runtime-references,-cert-msc32-c,-cert-msc30-c,-cert-msc50-cpp,-cert-msc51-cpp,-clang-analyzer-security.insecureAPI.rand' WarningsAsErrors: '*' HeaderFilterRegex: '.*' CheckOptions: – { key: readability-identifier-naming.ClassCase, value: CamelCase } – { key: readability-identifier-naming.StructCase, value: CamelCase } – { key: readability-identifier-naming.EnumCase, value: CamelCase } – { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } – { key: readability-identifier-naming.VariableCase, value: camelBack } – { key: readability-identifier-naming.ParameterCase, value: camelBack } – { key: readability-identifier-naming.PublicMemberCase, value: camelBack } # No good consensus on function names problem.isFinished() and GetInputFromUser() are both good # – { key: readability-identifier-naming.FunctionCase, value: camelBack } # – { key: readability-identifier-naming.PublicMethodCase, value: camelBack } # – { key: readability-identifier-naming.PrivateMethodCase, value: camelBack } ######################################################################## # Disabled checks ######################################################################## # -fuchsia-*, # Checks associated with fuchsia operating system # -cppcoreguidelines-owning-memory, # Using and learning about raw pointers, not type-based semantics of gsl::owner<T*> # -cppcoreguidelines-pro-bounds-array-to-pointer-decay, # Using pointers to arrays # -cppcoreguidelines-pro-bounds-pointer-arithmetic, # Not using <span> which is in C++20 # -google-build-using-namespace, # Will use "using namespace std" to make code easier to read # -hicpp-no-array-decay, # Using pointers to arrays # -modernize-use-trailing-return-type, # Not using the modern return type indications such as "factorial(int n) -> int" # -llvm-header-guard # Will use short header guards not full directory and file name # -cert-err60-cpp # Want to be able to throw exception with string # -cppcoreguidelines-pro-bounds-constant-array-index # Want to use array[index] without having to use gsl::at() # -google-global-names-in-headers # Readability, want to have "using namespace std;" in headers as well # -cppcoreguidelines-avoid-magic-numbers # When testing we use magic numbers # -readability-magic-numbers # When testing we use magic numbers # -google-runtime-references # Want to pass non-const references and modify them # -cert-msc32-c, cert-msc30-c # Using seed for rand for easy testing # -cert-msc50-cpp, cert-msc51-cpp, clang-analyzer-security.insecureAPI.rand # Using rand() rather than random library, less random burt easier
2022win343d-graph-samsyl916/self-evaluation.md
# Self-Evaluation ## Name(s): Out of 20 points. Use output.txt created using `./create-output.sh > output.txt 2>&1` for guidance. Complete all questions with "Q:" Q: Does the program compile and run to completion: Yes/No – If the program does not compile or gives a segmentation error when run, the maximum possible grade is 50%. No need to continue with the rest of self-evaluation Q: All public functions have been implemented: ENTER_NUMBER – -1 for each public function not implemented – Constructors: Graph() – Destructor: ~Graph() – Helpers: contains, verticesSize, edgesSize, vertexDegree, getEdgesAsString – Modifiers: add, connect, disconnect, readFile – Algorithms: dfs, bfs, dijkstra, mstPrim Q: Bonus function – mstKruskal: ENTER_NUMBER – +1 if Minimum Spanning Tree using Kruskal's algorithm has been implemented Q: -1 for each compilation warning, min -3: ENTER_NUMBER – Check under *1. Compiles without warnings* – If the warning message is addressed in README.md, including how the programmer tried to address it, no deductions Q: -1 for each clang-tidy warning, min -3: ENTER_NUMBER – Check under *3. clang-tidy warnings* – If the warning message is addressed in README.md, including how the programmer tried to address it, no deductions Q: -1 for each clang-format warning, min -3: ENTER_NUMBER – Check under *4. clang-format does not find any formatting issues* Q: Runs and produces correct output: ENTER_NUMBER – Try running "./a.out". assert statement should test the code Q: -2 for any detected memory leak: ENTER_NUMBER – Check under *5. No memory leaks using g++* – Check under *6. No memory leaks using valgrind* Q: Do the tests sufficiently test the code, min -6: ENTER_NUMBER – All public functions should be called at least once. – -2 for each function that is never called when testing – Check under *7. Tests have full code coverage* paying attention to *The lines below were never executed* Q: Are all functions in .h and .cpp file documented (min -3): ENTER_NUMBER – You need at least 1-line of comments – -1 for each function not documented Q: Total points: ADD_ALL_POINTS
2022win343d-graph-samsyl916/graph.h
/** * A graph is made up of vertices and edges. * Vertex labels are unique. * A vertex can be connected to other vertices via weighted, directed edge. * A vertex cannot connect to itself or have multiple edges to the same vertex */ #ifndef GRAPH_H #define GRAPH_H #include <map> #include <string> using namespace std; class Graph { public: // constructor, empty graph explicit Graph(bool directionalEdges = true); // copy not allowed Graph(const Graph &other) = delete; // move not allowed Graph(Graph &&other) = delete; // assignment not allowed Graph &operator=(const Graph &other) = delete; // move assignment not allowed Graph &operator=(Graph &&other) = delete; /** destructor, delete all vertices and edges */ ~Graph(); // @return true if vertex added, false if it already is in the graph bool add(const string &label); // @return true if vertex is in the graph bool contains(const string &label) const; // @return total number of vertices int verticesSize() const; // Add an edge between two vertices, create new vertices if necessary // A vertex cannot connect to itself, cannot have P->P // For digraphs (directed graphs), only one directed edge allowed, P->Q // Undirected graphs must have P->Q and Q->P with same weight // @return true if successfully connected bool connect(const string &from, const string &to, int weight = 0); // Remove edge from graph // @return true if edge successfully deleted bool disconnect(const string &from, const string &to); // @return total number of edges int edgesSize() const; // @return number of edges from given vertex, -1 if vertex not found int vertexDegree(const string &label) const; // @return string representing edges and weights, "" if vertex not found // A-3->B, A-5->C should return B(3),C(5) string getEdgesAsString(const string &label) const; // Read edges from file // first line of file is an integer, indicating number of edges // each line represents an edge in the form of "string string int" // vertex labels cannot contain spaces // @return true if file successfully read bool readFile(const string &filename); // depth-first traversal starting from given startLabel void dfs(const string &startLabel, void visit(const string &label)); // breadth-first traversal starting from startLabel // call the function visit on each vertex label */ void bfs(const string &startLabel, void visit(const string &label)); // dijkstra's algorithm to find shortest distance to all other vertices // and the path to all other vertices // Path cost is recorded in the map passed in, e.g. weight["F"] = 10 // How to get to the vertex is recorded previous["F"] = "C" // @return a pair made up of two map objects, Weights and Previous pair<map<string, int>, map<string, string>> dijkstra(const string &startLabel) const; // minimum spanning tree using Prim's algorithm // ONLY works for NONDIRECTED graphs // ASSUMES the edge [P->Q] has the same weight as [Q->P] // @return length of the minimum spanning tree or -1 if start vertex not int mstPrim(const string &startLabel, void visit(const string &from, const string &to, int weight)) const; // minimum spanning tree using Kruskal's algorithm // ONLY works for NONDIRECTED graphs // ASSUMES the edge [P->Q] has the same weight as [Q->P] // @return length of the minimum spanning tree or -1 if start vertex not int mstKruskal(const string &startLabel, void visit(const string &from, const string &to, int weight)) const; }; #endif // GRAPH_H
2022win343d-graph-samsyl916/README.md
# Graph Graph class with several graph algorithms including depth-first search, breadth-first search, dijkstra's shortest path, minimum spanning tree ## Included Files – `graph.h, graph.cpp`: Graph class – `graphtest.cpp`: Test functions – `main.cpp`: A generic main file to call testAll() to run all tests
2022win343d-graph-samsyl916/create-output.sh
#!/bin/bash # Run this script as `./create-output.sh > output.txt 2>&1` # How we want to call our executable, # possibly with some command line parameters EXEC_PROGRAM="./a.out " # Timestamp for starting this script date MACHINE="" # Display machine name if uname command is available if hash uname 2>/dev/null; then uname -a MACHINE=`uname -a` fi # Display user name if id command is available if hash id 2>/dev/null; then id fi # If we are running as a GitHub action, install programs GITHUB_MACHINE='Linux fv-az' if [[ $MACHINE == *"${GITHUB_MACHINE}"* ]]; then echo "=====================================================" echo "Running as a GitHub action, attempting to install programs" echo "=====================================================" sudo apt-get update sudo apt-get install llvm clang-tidy valgrind fi # If we are running on CSSLAB and # clang-tidy is not active, print a message CSSLAB_MACHINE='Linux csslab' CLANG_TIDY_EXE='/opt/rh/llvm-toolset-7.0/root/bin/clang-tidy' if [[ $MACHINE == *"${CSSLAB_MACHINE}"* ]]; then if ! hash clang-tidy 2>/dev/null && [ -e "${CLANG_TIDY_EXE}" ] ; then echo "=====================================================" echo "ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR " echo "clang-tidy NOT found in path (but is in $CLANG_TIDY_EXE )" echo "Add the following command to ~/.bashrc file" echo " source scl_source enable llvm-toolset-7.0" echo "You can add the command by executing the following line" echo " echo "source scl_source enable llvm-toolset-7.0" >> ~/.bashrc" echo "=====================================================" exit fi fi # delete a.out, do not give any errors if it does not exist rm ./a.out 2>/dev/null echo "=====================================================" echo "1. Compiles without warnings with -Wall -Wextra flags" echo "=====================================================" g++ -g -std=c++11 -Wall -Wextra -Wno-sign-compare *.cpp echo "=====================================================" echo "2. Runs and produces correct output" echo "=====================================================" # Execute program $EXEC_PROGRAM echo "=====================================================" echo "3. clang-tidy warnings are fixed" echo "=====================================================" if hash clang-tidy 2>/dev/null; then clang-tidy *.cpp — -std=c++11 else echo "WARNING: clang-tidy not available." fi echo "=====================================================" echo "4. clang-format does not find any formatting issues" echo "=====================================================" if hash clang-format 2>/dev/null; then # different LLVMs have slightly different configurations which can break things, so regenerate echo "# generated using: clang-format -style=llvm -dump-config > .clang-format" > .clang-format clang-format -style=llvm -dump-config >> .clang-format for f in ./*.cpp; do echo "Running clang-format on $f" clang-format $f | diff $f – done else echo "WARNING: clang-format not available" fi echo "=====================================================" echo "5. No memory leaks using g++" echo "=====================================================" rm ./a.out 2>/dev/null g++ -std=c++11 -fsanitize=address -fno-omit-frame-pointer -g *.cpp # Execute program $EXEC_PROGRAM > /dev/null 2> /dev/null echo "=====================================================" echo "6. No memory leaks using valgrind, look for "definitely lost" " echo "=====================================================" rm ./a.out 2>/dev/null if hash valgrind 2>/dev/null; then g++ -g -std=c++11 *.cpp # redirect program output to /dev/null will running valgrind valgrind –log-file="valgrind-output.txt" $EXEC_PROGRAM > /dev/null 2>/dev/null cat valgrind-output.txt rm valgrind-output.txt 2>/dev/null else echo "WARNING: valgrind not available" fi echo "=====================================================" echo "7. Tests have full code coverage" echo "=====================================================" if [ -f "check-code-coverage.sh" ]; then ./check-code-coverage.sh else echo "WARNING: check-code-coverage.sh script is missing" fi # Remove the executable rm -rf ./a.out* 2>/dev/null date echo "=====================================================" echo "To create an output.txt file with all the output from this script" echo "Run the below command" echo " ./create-output.sh > output.txt 2>&1 " echo "====================================================="
2022win343d-graph-samsyl916/.gitignore
# Prerequisites *.d # Compiled Object files *.slo *.lo *.o *.obj # Precompiled Headers *.gch *.pch # Compiled Dynamic libraries *.so *.dylib *.dll # Fortran module files *.mod *.smod # Compiled Static libraries *.lai *.la *.a *.lib # Executables *.exe *.out *.app # Mac Info.plist # VSCode .vscode/settings.json
2022win343d-graph-samsyl916/.clang-format
# generated using: clang-format -style=llvm -dump-config > .clang-format — Language: Cpp # BasedOnStyle: LLVM AccessModifierOffset: -2 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Right AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine BinPackArguments: true BinPackParameters: true BraceWrapping: AfterClass: false AfterControlStatement: false AfterEnum: false AfterFunction: false AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false AfterExternBlock: false BeforeCatch: false BeforeElse: false IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true BreakBeforeBinaryOperators: None BreakBeforeBraces: Attach BreakBeforeInheritanceComma: false BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: – foreach – Q_FOREACH – BOOST_FOREACH IncludeBlocks: Preserve IncludeCategories: – Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 – Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 – Regex: '.*' Priority: 1 IncludeIsMainRegex: '(Test)?$' IndentCaseLabels: false IndentPPDirectives: None IndentWidth: 2 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 2 ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right ReflowComments: true SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never …
__MACOSX/2022win343d-graph-samsyl916/._.github
2022win343d-graph-samsyl916/.gitattributes
# Set the default behavior, in case people don't have core.autocrlf set. * text=auto # Always have LF for unix script simplecompile.sh eol=lf
2022win343d-graph-samsyl916/graph4.txt
17 A B 6 A E 2 A F 2 A H 8 B D 9 B E 1 B H 5 C K 4 C L 3 D K 1 E G 1 E I 1 E J 3 F G 6 H L 3 I J 3 I K 1
__MACOSX/2022win343d-graph-samsyl916/._.git
2022win343d-graph-samsyl916/check-code-coverage.sh
#!/bin/bash # Compile the program with code coverage flags and generate report # Basedon information from # https://github.com/mapbox/cpp/blob/master/docs/coverage.md # How we want to call our executable, # possibly with some command line parameters EXEC_PROGRAM="./a.out " ###################################################################### PROG=$0 EXE="a.out" PROFDATA=$EXE.profdata CC=clang++ rm $EXE $PROFDATA default.profraw 2>/dev/null programs=($CC "llvm-profdata" "llvm-cov") for p in "${programs[@]}"; do if ! hash $CC 2>/dev/null; then echo "ERROR: $PROG: cannot find $CC executable" exit 1 fi done $CC -g -std=c++11 -fprofile-instr-generate -fcoverage-mapping *.cpp -o $EXE if [ ! -f $EXE ]; then echo "ERROR: $PROG: Failed to create executable" exit 1 fi # Execute the program $EXEC_PROGRAM > /dev/null 2>/dev/null if [ ! -f "default.profraw" ]; then echo "ERROR: $PROG: Failed to create default.profraw data" rm -rf ./a.out* exit 1 fi llvm-profdata merge default.profraw -output=$PROFDATA if [ ! -f $PROFDATA ]; then echo "ERROR: $PROG: Failed to create $PROFDATA" rm -rf ./a.out* default.profraw exit 1 fi # GitHub actions do not have demangler program if hash llvm-cxxfilt 2>/dev/null; then llvm-cov report -show-functions=1 -Xdemangler=llvm-cxxfilt $EXE -instr-profile=$PROFDATA *.cpp else llvm-cov report -show-functions=1 $EXE -instr-profile=$PROFDATA *.cpp fi echo "=====================================================" echo "The lines below were never executed" echo "=====================================================" llvm-cov show $EXE -instr-profile=$PROFDATA | grep " 0|" rm -rf ./a.out* $EXE $PROFDATA default.profraw 2>/dev/null
2022win343d-graph-samsyl916/graph3.txt
7 K F 0 F C 0 F J 0 K N 0 N L 0 L M 0 N O 0
2022win343d-graph-samsyl916/graph2.txt
24 A B 0 A C 0 A D 0 B E 0 B F 0 C G 0 D H 0 D I 0 F J 0 G K 0 G L 0 H M 0 I M 0 I N 0 O P 5 O Q 2 P R 2 Q R 1 R O 1 R S 3 S R 1 S T 2 S U 3 T O 8
2022win343d-graph-samsyl916/main.cpp
2022win343d-graph-samsyl916/main.cpp
/**
* Driver for tests
*/
#include < iostream >
using namespace std ;
// forward declaration, implementation in xxxtest.cpp
void testAll ();
int main () {
testAll ();
cout << "Done!" << endl ;
return 0 ;
}
2022win343d-graph-samsyl916/output.txt
Sun Jan 24 08:54:43 PST 2021 Darwin silvery 17.7.0 Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT 2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64 x86_64 uid=501(yusuf) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),701(com.apple.sharepoint.group.1),702(com.apple.sharepoint.group.2) ===================================================== 1. Compiles without warnings with -Wall -Wextra flags ===================================================== ===================================================== 2. Runs and produces correct output ===================================================== testGraph0DFS testGraph0BFS testGraph0Dijkstra testGraph0NotDirected testGraph1 Done! ===================================================== 3. clang-tidy warnings are fixed ===================================================== 6 warnings generated. 25715 warnings generated. 47959 warnings generated. 67631 warnings generated. 88632 warnings generated. /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:20:16: warning: invalid case style for parameter 'from' [readability-identifier-naming] Edge(Vertex *from, Vertex *to, int weight) ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:20:30: warning: invalid case style for parameter 'to' [readability-identifier-naming] Edge(Vertex *from, Vertex *to, int weight) ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:20:38: warning: invalid case style for parameter 'weight' [readability-identifier-naming] Edge(Vertex *from, Vertex *to, int weight) ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:24:11: warning: invalid case style for member 'from' [readability-identifier-naming] Vertex *from; ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:27:11: warning: invalid case style for member 'to' [readability-identifier-naming] Vertex *to; ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/edge.h:30:7: warning: invalid case style for member 'weight' [readability-identifier-naming] int weight; ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:14:19: warning: invalid case style for parameter 'directionalEdges' [readability-identifier-naming] Graph::Graph(bool directionalEdges) ^~~~~~~~~~~~~~~~ DirectionalEdges /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:18:14: warning: invalid case style for variable 'vp' [readability-identifier-naming] for (auto &vp : vertices) ^~ Vp /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:26:40: warning: invalid case style for parameter 'label' [readability-identifier-naming] int Graph::neighborsSize(const string &label) const { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:27:11: warning: invalid case style for variable 'v' [readability-identifier-naming] Vertex *v = findVertex(label); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:31:31: warning: invalid case style for parameter 'label' [readability-identifier-naming] bool Graph::add(const string &label) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:32:11: warning: invalid case style for variable 'v' [readability-identifier-naming] Vertex *v = findVertex(label); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:39:36: warning: invalid case style for parameter 'label' [readability-identifier-naming] bool Graph::contains(const string &label) const { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:40:10: warning: invalid case style for variable 'vLabel' [readability-identifier-naming] string vLabel = modifyIfAllDigits(label); ^~~~~~ VLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:44:46: warning: invalid case style for parameter 'label' [readability-identifier-naming] string Graph::getEdgesAsString(const string &label) const { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:45:3: warning: 'auto V' can be declared as 'auto *V' [llvm-qualified-auto] auto V = findVertex(label); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:45:3: warning: 'auto V' can be declared as 'auto *V' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:51:35: warning: invalid case style for parameter 'from' [readability-identifier-naming] bool Graph::connect(const string &from, const string &to, int weight) { ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:51:55: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool Graph::connect(const string &from, const string &to, int weight) { ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:51:63: warning: invalid case style for parameter 'weight' [readability-identifier-naming] bool Graph::connect(const string &from, const string &to, int weight) { ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:54:3: warning: 'auto fx' can be declared as 'auto *fx' [llvm-qualified-auto] auto fx = findVertex(from); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:54:3: warning: 'auto fx' can be declared as 'auto *fx' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:54:8: warning: invalid case style for variable 'fx' [readability-identifier-naming] auto fx = findVertex(from); ^~ Fx /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:57:3: warning: 'auto tx' can be declared as 'auto *tx' [llvm-qualified-auto] auto tx = findVertex(to); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:57:3: warning: 'auto tx' can be declared as 'auto *tx' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:57:8: warning: invalid case style for variable 'tx' [readability-identifier-naming] auto tx = findVertex(to); ^~ Tx /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:73:38: warning: invalid case style for parameter 'from' [readability-identifier-naming] bool Graph::disconnect(const string &from, const string &to) { ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:73:58: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool Graph::disconnect(const string &from, const string &to) { ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:74:3: warning: 'auto fx' can be declared as 'auto *fx' [llvm-qualified-auto] auto fx = findVertex(from); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:74:3: warning: 'auto fx' can be declared as 'auto *fx' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:74:8: warning: invalid case style for variable 'fx' [readability-identifier-naming] auto fx = findVertex(from); ^~ Fx /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:75:3: warning: 'auto tx' can be declared as 'auto *tx' [llvm-qualified-auto] auto tx = findVertex(to); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:75:3: warning: 'auto tx' can be declared as 'auto *tx' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:75:8: warning: invalid case style for variable 'tx' [readability-identifier-naming] auto tx = findVertex(to); ^~ Tx /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:78:8: warning: invalid case style for variable 'successfullyDisconnected' [readability-identifier-naming] bool successfullyDisconnected = fx->disconnect(tx); ^~~~~~~~~~~~~~~~~~~~~~~~ SuccessfullyDisconnected /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:84:41: warning: invalid case style for parameter 'label' [readability-identifier-naming] Vertex *Graph::findVertex(const string &label) const { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:85:10: warning: invalid case style for variable 'vLabel' [readability-identifier-naming] string vLabel = modifyIfAllDigits(label); ^~~~~~ VLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:86:8: warning: invalid case style for variable 'vp' [readability-identifier-naming] auto vp = vertices.find(vLabel); ^~ Vp /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:90:47: warning: invalid case style for parameter 'label' [readability-identifier-naming] string Graph::modifyIfAllDigits(const string &label) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:95:8: warning: invalid case style for variable 'allD' [readability-identifier-naming] bool allD = true; ^~~~ AllD /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:96:7: warning: invalid case style for variable 'i' [readability-identifier-naming] int i = 0; ^ I /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:102:10: warning: invalid case style for variable 'c' [readability-identifier-naming] char c = static_cast<char>('A' + stoi(label)); ^ C /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:108:43: warning: invalid case style for parameter 'label' [readability-identifier-naming] Vertex *Graph::createVertex(const string &label) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:109:10: warning: invalid case style for variable 'vLabel' [readability-identifier-naming] string vLabel = modifyIfAllDigits(label); ^~~~~~ VLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:110:3: warning: 'auto v' can be declared as 'auto *v' [llvm-qualified-auto] auto v = new Vertex(vLabel); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:110:3: warning: 'auto v' can be declared as 'auto *v' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:110:8: warning: invalid case style for variable 'v' [readability-identifier-naming] auto v = new Vertex(vLabel); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:116:14: warning: invalid case style for variable 'vp' [readability-identifier-naming] for (auto &vp : vertices) ^~ Vp /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:120:31: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] void Graph::dfs(const string &startLabel, void visit(const string &label)) { ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:120:48: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void Graph::dfs(const string &startLabel, void visit(const string &label)) { ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:120:68: warning: invalid case style for parameter 'label' [readability-identifier-naming] void Graph::dfs(const string &startLabel, void visit(const string &label)) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:121:3: warning: 'auto v' can be declared as 'auto *v' [llvm-qualified-auto] auto v = findVertex(startLabel); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:121:3: warning: 'auto v' can be declared as 'auto *v' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:121:8: warning: invalid case style for variable 'v' [readability-identifier-naming] auto v = findVertex(startLabel); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:128:31: warning: invalid case style for parameter 'v' [readability-identifier-naming] void Graph::dfsHelper(Vertex *v, void visit(const string &label)) { ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:128:39: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void Graph::dfsHelper(Vertex *v, void visit(const string &label)) { ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:128:59: warning: invalid case style for parameter 'label' [readability-identifier-naming] void Graph::dfsHelper(Vertex *v, void visit(const string &label)) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:130:10: warning: invalid case style for variable 'label' [readability-identifier-naming] string label = v->label; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:132:14: warning: invalid case style for variable 'e' [readability-identifier-naming] for (auto &e : v->edges) { ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:138:31: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] void Graph::bfs(const string &startLabel, void visit(const string &label)) { ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:138:48: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void Graph::bfs(const string &startLabel, void visit(const string &label)) { ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:138:68: warning: invalid case style for parameter 'label' [readability-identifier-naming] void Graph::bfs(const string &startLabel, void visit(const string &label)) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:139:11: warning: invalid case style for variable 'v' [readability-identifier-naming] Vertex *v = findVertex(startLabel); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:146:31: warning: invalid case style for parameter 'v' [readability-identifier-naming] void Graph::bfsHelper(Vertex *v, void visit(const string &label)) { ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:146:39: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void Graph::bfsHelper(Vertex *v, void visit(const string &label)) { ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:146:59: warning: invalid case style for parameter 'label' [readability-identifier-naming] void Graph::bfsHelper(Vertex *v, void visit(const string &label)) { ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:147:19: warning: invalid case style for variable 'vertexQueue' [readability-identifier-naming] queue<Vertex *> vertexQueue; ^~~~~~~~~~~ VertexQueue /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:152:5: warning: 'auto front' can be declared as 'auto *front' [llvm-qualified-auto] auto front = vertexQueue.front(); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:152:5: warning: 'auto front' can be declared as 'auto *front' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:152:10: warning: invalid case style for variable 'front' [readability-identifier-naming] auto front = vertexQueue.front(); ^~~~~ Front /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:154:12: warning: invalid case style for variable 'label' [readability-identifier-naming] string label = front->label; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:156:16: warning: invalid case style for variable 'e' [readability-identifier-naming] for (auto &e : front->edges) { ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:168:31: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] Graph::dijkstra(const string &startLabel) const { ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:169:20: warning: invalid case style for variable 'weights' [readability-identifier-naming] map<string, int> weights; ^~~~~~~ Weights /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:170:23: warning: invalid case style for variable 'previous' [readability-identifier-naming] map<string, string> previous; ^~~~~~~~ Previous /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:171:11: warning: invalid case style for variable 'startVertex' [readability-identifier-naming] Vertex *startVertex = findVertex(startLabel); ^~~~~~~~~~~ StartVertex /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:175:47: warning: invalid case style for variable 'pq' [readability-identifier-naming] priority_queue<IV, vector<IV>, greater<IV>> pq; ^~ Pq /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:176:17: warning: invalid case style for variable 'vertexSet' [readability-identifier-naming] set<Vertex *> vertexSet; ^~~~~~~~~ VertexSet /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:179:20: warning: invalid case style for variable 'e' [readability-identifier-naming] for (const auto &e : startVertex->edges) { ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:185:5: warning: 'auto v' can be declared as 'auto *v' [llvm-qualified-auto] auto v = pq.top().second; ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:185:5: warning: 'auto v' can be declared as 'auto *v' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:185:10: warning: invalid case style for variable 'v' [readability-identifier-naming] auto v = pq.top().second; ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:190:22: warning: invalid case style for variable 'e' [readability-identifier-naming] for (const auto &e : v->edges) { ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:191:7: warning: 'auto u' can be declared as 'auto *u' [llvm-qualified-auto] auto u = e->to; ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:191:7: warning: 'auto u' can be declared as 'auto *u' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:191:12: warning: invalid case style for variable 'u' [readability-identifier-naming] auto u = e->to; ^ U /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:194:11: warning: invalid case style for variable 'newPathCost' [readability-identifier-naming] int newPathCost = weights[v->label] + e->weight; ^~~~~~~~~~~ NewPathCost /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:195:14: warning: invalid case style for variable 'uLabel' [readability-identifier-naming] string uLabel = u->label; ^~~~~~ ULabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:212:30: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] int Graph::mst(const string &startLabel, ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:213:21: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void visit(const string &from, const string &to, ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:213:41: warning: invalid case style for parameter 'from' [readability-identifier-naming] void visit(const string &from, const string &to, ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:213:61: warning: invalid case style for parameter 'to' [readability-identifier-naming] void visit(const string &from, const string &to, ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:214:31: warning: invalid case style for parameter 'weight' [readability-identifier-naming] int weight)) const { ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:215:3: warning: 'auto v' can be declared as 'auto *v' [llvm-qualified-auto] auto v = findVertex(startLabel); ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:215:3: warning: 'auto v' can be declared as 'auto *v' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:215:8: warning: invalid case style for variable 'v' [readability-identifier-naming] auto v = findVertex(startLabel); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:218:17: warning: invalid case style for variable 'mstVertices' [readability-identifier-naming] set<Vertex *> mstVertices; ^~~~~~~~~~~ MstVertices /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:220:53: warning: invalid case style for variable 'potentials' [readability-identifier-naming] priority_queue<IntE, vector<IntE>, greater<IntE>> potentials; ^~~~~~~~~~ Potentials /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:221:7: warning: invalid case style for variable 'total' [readability-identifier-naming] int total = 0; ^~~~~ Total /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:223:8: warning: 'auto E' can be declared as 'auto *E' [llvm-qualified-auto] for (auto E : v->edges) ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:223:8: warning: 'auto E' can be declared as 'auto *E' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:226:5: warning: 'auto e' can be declared as 'auto *e' [llvm-qualified-auto] auto e = potentials.top().second; ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:226:5: warning: 'auto e' can be declared as 'auto *e' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:226:10: warning: invalid case style for variable 'e' [readability-identifier-naming] auto e = potentials.top().second; ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:233:10: warning: 'auto e2' can be declared as 'auto *e2' [llvm-qualified-auto] for (auto e2 : e->to->edges) ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:233:10: warning: 'auto e2' can be declared as 'auto *e2' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:233:15: warning: invalid case style for variable 'e2' [readability-identifier-naming] for (auto e2 : e->to->edges) ^~ E2 /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:255:36: warning: invalid case style for parameter 'filename' [readability-identifier-naming] bool Graph::readFile(const string &filename) { ^~~~~~~~ Filename /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:256:12: warning: invalid case style for variable 'myfile' [readability-identifier-naming] ifstream myfile(filename); ^~~~~~ Myfile /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:261:7: warning: variable 'edges' is not initialized [cppcoreguidelines-init-variables] int edges; ^ = 0 /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:261:7: warning: invalid case style for variable 'edges' [readability-identifier-naming] int edges; ^~~~~ Edges /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:262:7: warning: variable 'weight' is not initialized [cppcoreguidelines-init-variables] int weight; ^ = 0 /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:262:7: warning: invalid case style for variable 'weight' [readability-identifier-naming] int weight; ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:263:10: warning: invalid case style for variable 'fromVertex' [readability-identifier-naming] string fromVertex; ^~~~~~~~~~ FromVertex /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:264:10: warning: invalid case style for variable 'toVertex' [readability-identifier-naming] string toVertex; ^~~~~~~~ ToVertex /Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:266:12: warning: invalid case style for variable 'i' [readability-identifier-naming] for (int i = 0; i < edges; ++i) { ^ ~ ~ I I I /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:21:23: warning: invalid case style for parameter 'directionalEdges' [readability-identifier-naming] explicit Graph(bool directionalEdges = true); ^~~~~~~~~~~~~~~~ DirectionalEdges /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:27:26: warning: invalid case style for parameter 'label' [readability-identifier-naming] bool add(const string &label); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:30:31: warning: invalid case style for parameter 'label' [readability-identifier-naming] bool contains(const string &label) const; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:40:30: warning: invalid case style for parameter 'from' [readability-identifier-naming] bool connect(const string &from, const string &to, int weight = 0); ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:40:50: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool connect(const string &from, const string &to, int weight = 0); ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:40:58: warning: invalid case style for parameter 'weight' [readability-identifier-naming] bool connect(const string &from, const string &to, int weight = 0); ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:44:33: warning: invalid case style for parameter 'from' [readability-identifier-naming] bool disconnect(const string &from, const string &to); ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:44:53: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool disconnect(const string &from, const string &to); ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:50:35: warning: invalid case style for parameter 'label' [readability-identifier-naming] int neighborsSize(const string &label) const; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:54:41: warning: invalid case style for parameter 'label' [readability-identifier-naming] string getEdgesAsString(const string &label) const; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:61:31: warning: invalid case style for parameter 'filename' [readability-identifier-naming] bool readFile(const string &filename); ^~~~~~~~ Filename /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:64:26: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] void dfs(const string &startLabel, void visit(const string &label)); ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:64:43: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void dfs(const string &startLabel, void visit(const string &label)); ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:64:63: warning: invalid case style for parameter 'label' [readability-identifier-naming] void dfs(const string &startLabel, void visit(const string &label)); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:68:26: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] void bfs(const string &startLabel, void visit(const string &label)); ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:68:43: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void bfs(const string &startLabel, void visit(const string &label)); ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:68:63: warning: invalid case style for parameter 'label' [readability-identifier-naming] void bfs(const string &startLabel, void visit(const string &label)); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:76:26: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] dijkstra(const string &startLabel) const; ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:82:25: warning: invalid case style for parameter 'startLabel' [readability-identifier-naming] int mst(const string &startLabel, ^~~~~~~~~~ StartLabel /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:83:16: warning: invalid case style for parameter 'visit' [readability-identifier-naming] void visit(const string &from, const string &to, int weight)) const; ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:83:36: warning: invalid case style for parameter 'from' [readability-identifier-naming] void visit(const string &from, const string &to, int weight)) const; ^~~~ From /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:83:56: warning: invalid case style for parameter 'to' [readability-identifier-naming] void visit(const string &from, const string &to, int weight)) const; ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:83:64: warning: invalid case style for parameter 'weight' [readability-identifier-naming] void visit(const string &from, const string &to, int weight)) const; ^~~~~~ Weight /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:88:8: warning: invalid case style for member 'directionalEdges' [readability-identifier-naming] bool directionalEdges; ^~~~~~~~~~~~~~~~ DirectionalEdges /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:94:33: warning: invalid case style for parameter 'v' [readability-identifier-naming] static void dfsHelper(Vertex *v, void visit(const string &label)); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:94:41: warning: invalid case style for parameter 'visit' [readability-identifier-naming] static void dfsHelper(Vertex *v, void visit(const string &label)); ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:94:61: warning: invalid case style for parameter 'label' [readability-identifier-naming] static void dfsHelper(Vertex *v, void visit(const string &label)); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:97:33: warning: invalid case style for parameter 'v' [readability-identifier-naming] static void bfsHelper(Vertex *v, void visit(const string &label)); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:97:41: warning: invalid case style for parameter 'visit' [readability-identifier-naming] static void bfsHelper(Vertex *v, void visit(const string &label)); ^~~~~ Visit /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:97:61: warning: invalid case style for parameter 'label' [readability-identifier-naming] static void bfsHelper(Vertex *v, void visit(const string &label)); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:101:36: warning: invalid case style for parameter 'label' [readability-identifier-naming] Vertex *findVertex(const string &label) const; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:104:38: warning: invalid case style for parameter 'label' [readability-identifier-naming] Vertex *createVertex(const string &label); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:107:7: warning: use default member initializer for 'numberOfEdges' [modernize-use-default-member-init] int numberOfEdges; ^ {0} /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:107:7: warning: invalid case style for member 'numberOfEdges' [readability-identifier-naming] int numberOfEdges; ^~~~~~~~~~~~~ NumberOfEdges /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:110:25: warning: invalid case style for member 'vertices' [readability-identifier-naming] map<string, Vertex *> vertices; ^~~~~~~~ Vertices /Users/yusuf/bitbucket/pisan343/graph-solution/graph.h:112:49: warning: invalid case style for parameter 'label' [readability-identifier-naming] static string modifyIfAllDigits(const string &label); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:21:30: warning: invalid case style for parameter 'os' [readability-identifier-naming] ostream &operator<<(ostream &os, const Vertex &v) { ^~ Os /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:21:48: warning: invalid case style for parameter 'v' [readability-identifier-naming] ostream &operator<<(ostream &os, const Vertex &v) { ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:25:30: warning: invalid case style for parameter 'label' [readability-identifier-naming] Vertex::Vertex(const string &label) : label{label} {} ^~~~~ ~~~~~ Label Label /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:28:8: warning: 'auto e' can be declared as 'auto *e' [llvm-qualified-auto] for (auto e : edges) ^ note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:28:8: warning: 'auto e' can be declared as 'auto *e' [readability-qualified-auto] note: this fix will not be applied because it overlaps with another fix /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:28:13: warning: invalid case style for variable 'e' [readability-identifier-naming] for (auto e : edges) ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:32:30: warning: invalid case style for parameter 'toVertex' [readability-identifier-naming] bool Vertex::hasEdge(Vertex *toVertex) const { ^~~~~~~~ ToVertex /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:36:34: warning: invalid case style for parameter 'e' [readability-identifier-naming] [toVertex](Edge *e) { return e->to == toVertex; }); ^ ~ E E /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:47:9: warning: variable 'e' is not initialized [cppcoreguidelines-init-variables] Edge *e; ^ = nullptr /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:47:9: warning: invalid case style for variable 'e' [readability-identifier-naming] Edge *e; ^ E /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:49:16: warning: invalid case style for variable 'ss' [readability-identifier-naming] stringstream ss; ^~ Ss /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:60:30: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool Vertex::connect(Vertex *to, int edgeWeight) { ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:60:38: warning: invalid case style for parameter 'edgeWeight' [readability-identifier-naming] bool Vertex::connect(Vertex *to, int edgeWeight) { ^~~~~~~~~~ EdgeWeight /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:61:9: warning: invalid case style for variable 'myEdge' [readability-identifier-naming] auto *myEdge = new Edge(this, to, edgeWeight); ^~~~~~ MyEdge /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:63:51: warning: invalid case style for parameter 'a' [readability-identifier-naming] sort(edges.begin(), edges.end(), [](class Edge *a, class Edge *b) { ^ A /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:63:66: warning: invalid case style for parameter 'b' [readability-identifier-naming] sort(edges.begin(), edges.end(), [](class Edge *a, class Edge *b) { ^ B /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:71:33: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool Vertex::disconnect(Vertex *to) { ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.cpp:74:7: warning: invalid case style for variable 'index' [readability-identifier-naming] int index = 0; ^~~~~ Index /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:24:39: warning: invalid case style for parameter 'os' [readability-identifier-naming] friend ostream &operator<<(ostream &os, const Vertex &v); ^~ Os /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:24:57: warning: invalid case style for parameter 'v' [readability-identifier-naming] friend ostream &operator<<(ostream &os, const Vertex &v); ^ V /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:30:33: warning: invalid case style for parameter 'label' [readability-identifier-naming] explicit Vertex(const string &label); ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:37:10: warning: invalid case style for member 'label' [readability-identifier-naming] string label; ^~~~~ Label /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:40:8: warning: invalid case style for member 'isVisited' [readability-identifier-naming] bool isVisited{false}; ^~~~~~~~~ IsVisited /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:42:24: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool connect(Vertex *to, int edgeWeight = 0); ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:42:32: warning: invalid case style for parameter 'edgeWeight' [readability-identifier-naming] bool connect(Vertex *to, int edgeWeight = 0); ^~~~~~~~~~ EdgeWeight /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:43:27: warning: invalid case style for parameter 'to' [readability-identifier-naming] bool disconnect(Vertex *to); ^~ To /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:45:24: warning: invalid case style for parameter 'toVertex' [readability-identifier-naming] bool hasEdge(Vertex *toVertex) const; ^~~~~~~~ ToVertex /Users/yusuf/bitbucket/pisan343/graph-solution/vertex.h:51:18: warning: invalid case style for member 'edges' [readability-identifier-naming] vector<Edge *> edges; ^~~~~ Edges Suppressed 88380 warnings (88379 in non-user code, 1 NOLINT). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. ===================================================== 4. clang-format does not find any formatting issues ===================================================== Running clang-format on ./edge.cpp Running clang-format on ./graph.cpp Running clang-format on ./graphtest.cpp Running clang-format on ./main.cpp Running clang-format on ./vertex.cpp ===================================================== 5. No memory leaks using g++ ===================================================== ===================================================== 6. No memory leaks using valgrind, look for "definitely lost" ===================================================== ==77354== Memcheck, a memory error detector ==77354== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==77354== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info ==77354== Command: ./a.out ==77354== Parent PID: 77148 ==77354== ==77354== ==77354== HEAP SUMMARY: ==77354== in use at exit: 84,039 bytes in 168 blocks ==77354== total heap usage: 432 allocs, 264 frees, 160,759 bytes allocated ==77354== ==77354== LEAK SUMMARY: ==77354== definitely lost: 0 bytes in 0 blocks ==77354== indirectly lost: 0 bytes in 0 blocks ==77354== possibly lost: 72 bytes in 3 blocks ==77354== still reachable: 65,736 bytes in 7 blocks ==77354== suppressed: 18,231 bytes in 158 blocks ==77354== Rerun with –leak-check=full to see details of leaked memory ==77354== ==77354== For lists of detected and suppressed errors, rerun with: -s ==77354== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1) ===================================================== 7. Tests have full code coverage ===================================================== warning: default.profraw: Unsupported instrumentation profile format version error: No profiles could be merged. ERROR: ./check-code-coverage.sh: Failed to create a.out.profdata Sun Jan 24 08:55:46 PST 2021 ===================================================== To create an output.txt file with all the output from this script Run the below command ./create-output.sh > output.txt 2>&1 =====================================================
2022win343d-graph-samsyl916/graph0.txt
3 A C 8 A B 1 B C 3 # we can write comments since only reading 3 lines A —->——-> C / / -> B ->-
2022win343d-graph-samsyl916/graph1.txt
9 A B 1 B C 1 C D 1 D E 1 E F 1 F G 1 A H 3 H G 1 X Y 10 # we can write comments since only reading 9 lines A –1–> B –1–> C –1–> D –1–> E –1–> F –1–> G | ^ | | 3 1 | | | | V | H————————->———>—————–^ X–10–>Y
__MACOSX/2022win343d-graph-samsyl916/._.idea
__MACOSX/2022win343d-graph-samsyl916/.github/._workflows
2022win343d-graph-samsyl916/.git/config
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [submodule] active = . [remote "origin"] url = https://github.com/uwbclass/2022win343d-graph-samsyl916.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master
__MACOSX/2022win343d-graph-samsyl916/.git/._objects
2022win343d-graph-samsyl916/.git/HEAD
ref: refs/heads/master
__MACOSX/2022win343d-graph-samsyl916/.git/._info
__MACOSX/2022win343d-graph-samsyl916/.git/._logs
2022win343d-graph-samsyl916/.git/description
Unnamed repository; edit this file 'description' to name the repository.
__MACOSX/2022win343d-graph-samsyl916/.git/._hooks
__MACOSX/2022win343d-graph-samsyl916/.git/._refs
2022win343d-graph-samsyl916/.git/index
2022win343d-graph-samsyl916/.git/packed-refs
# pack-refs with: peeled fully-peeled sorted edd34264e9d5bbba90854ea9f3ee6f02ff139475 refs/remotes/origin/master
2022win343d-graph-samsyl916/.idea/2022win343d-graph-samsyl916.iml
__MACOSX/2022win343d-graph-samsyl916/.idea/._codeStyles
2022win343d-graph-samsyl916/.idea/vcs.xml
2022win343d-graph-samsyl916/.idea/.gitignore
# Default ignored files /shelf/ /workspace.xml # Editor-based HTTP Client requests /httpRequests/ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml
2022win343d-graph-samsyl916/.idea/workspace.xml
1643535254524 1643535254524
2022win343d-graph-samsyl916/.idea/modules.xml
2022win343d-graph-samsyl916/.github/workflows/buildrun.yml
name: Basic compile, code checks, and test run on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest steps: – uses: actions/checkout@v2 – name: Run create-output.sh file run: chmod 755 create-output.sh; ./create-output.sh
__MACOSX/2022win343d-graph-samsyl916/.git/objects/._pack
__MACOSX/2022win343d-graph-samsyl916/.git/objects/._6e
__MACOSX/2022win343d-graph-samsyl916/.git/objects/._info
2022win343d-graph-samsyl916/.git/info/exclude
# git ls-files –others –exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~
2022win343d-graph-samsyl916/.git/logs/HEAD
0000000000000000000000000000000000000000 edd34264e9d5bbba90854ea9f3ee6f02ff139475 samsyl916 <[email protected]> 1643535245 -0800 clone: from https://github.com/uwbclass/2022win343d-graph-samsyl916.git
__MACOSX/2022win343d-graph-samsyl916/.git/logs/._refs
2022win343d-graph-samsyl916/.git/hooks/commit-msg.sample
#!/bin/sh # # An example hook script to check the commit log message. # Called by "git commit" with one argument, the name of the file # that has the commit message. The hook should exit with non-zero # status after issuing an appropriate message if it wants to stop the # commit. The hook is allowed to edit the commit message file. # # To enable this hook, rename this file to "commit-msg". # Uncomment the below to add a Signed-off-by line to the message. # Doing this in a hook is a bad idea in general, but the prepare-commit-msg # hook is more suited to it. # # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^(.*>).*$/Signed-off-by: 1/p') # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" # This example catches duplicate Signed-off-by lines. test "" = "$(grep '^Signed-off-by: ' "$1" | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { echo >&2 Duplicate Signed-off-by lines. exit 1 }
2022win343d-graph-samsyl916/.git/hooks/pre-rebase.sample
#!/bin/sh # # Copyright (c) 2006, 2008 Junio C Hamano # # The "pre-rebase" hook is run just before "git rebase" starts doing # its job, and can prevent the command from running by exiting with # non-zero status. # # The hook is called with the following parameters: # # $1 — the upstream the series was forked from. # $2 — the branch being rebased (or empty when rebasing the current branch). # # This sample shows how to prevent topic branches that are already # merged to 'next' branch from getting rebased, because allowing it # would result in rebasing already published history. publish=next basebranch="$1" if test "$#" = 2 then topic="refs/heads/$2" else topic=`git symbolic-ref HEAD` || exit 0 ;# we do not interrupt rebasing detached HEAD fi case "$topic" in refs/heads/??/*) ;; *) exit 0 ;# we do not interrupt others. ;; esac # Now we are dealing with a topic branch being rebased # on top of master. Is it OK to rebase it? # Does the topic really exist? git show-ref -q "$topic" || { echo >&2 "No such branch $topic" exit 1 } # Is topic fully merged to master? not_in_master=`git rev-list –pretty=oneline ^master "$topic"` if test -z "$not_in_master" then echo >&2 "$topic is fully merged to master; better remove it." exit 1 ;# we could allow it, but there is no point. fi # Is topic ever merged to next? If so you should not be rebasing it. only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` only_next_2=`git rev-list ^master ${publish} | sort` if test "$only_next_1" = "$only_next_2" then not_in_topic=`git rev-list "^$topic" master` if test -z "$not_in_topic" then echo >&2 "$topic is already up to date with master" exit 1 ;# we could allow it, but there is no point. else exit 0 fi else not_in_next=`git rev-list –pretty=oneline ^${publish} "$topic"` /usr/bin/perl -e ' my $topic = $ARGV[0]; my $msg = "* $topic has commits already merged to public branch:n"; my (%not_in_next) = map { /^([0-9a-f]+) /; ($1 => 1); } split(/n/, $ARGV[1]); for my $elem (map { /^([0-9a-f]+) (.*)$/; [$1 => $2]; } split(/n/, $ARGV[2])) { if (!exists $not_in_next{$elem->[0]}) { if ($msg) { print STDERR $msg; undef $msg; } print STDERR " $elem->[1]n"; } } ' "$topic" "$not_in_next" "$not_in_master" exit 1 fi <<DOC_END This sample hook safeguards topic branches that have been published from being rewound. The workflow assumed here is: * Once a topic branch forks from "master", "master" is never merged into it again (either directly or indirectly). * Once a topic branch is fully cooked and merged into "master", it is deleted. If you need to build on top of it to correct earlier mistakes, a new topic branch is created by forking at the tip of the "master". This is not strictly necessary, but it makes it easier to keep your history simple. * Whenever you need to test or publish your changes to topic branches, merge them into "next" branch. The script, being an example, hardcodes the publish branch name to be "next", but it is trivial to make it configurable via $GIT_DIR/config mechanism. With this workflow, you would want to know: (1) … if a topic branch has ever been merged to "next". Young topic branches can have stupid mistakes you would rather clean up before publishing, and things that have not been merged into other branches can be easily rebased without affecting other people. But once it is published, you would not want to rewind it. (2) … if a topic branch has been fully merged to "master". Then you can delete it. More importantly, you should not build on top of it — other people may already want to change things related to the topic as patches against your "master", so if you need further changes, it is better to fork the topic (perhaps with the same name) afresh from the tip of "master". Let's look at this example: o—o—o—o—o—o—o—o—o—o "next" / / / / / a—a—b A / / / / / / / / c—c—c—c B / / / / / / / / b—b C / / / / / / —o—o—o—o—o—o—o—o—o—o—o "master" A, B and C are topic branches. * A has one fix since it was merged up to "next". * B has finished. It has been fully merged up to "master" and "next", and is ready to be deleted. * C has not merged to "next" at all. We would want to allow C to be rebased, refuse A, and encourage B to be deleted. To compute (1): git rev-list ^master ^topic next git rev-list ^master next if these match, topic has not merged in next at all. To compute (2): git rev-list master..topic if this is empty, it is fully merged to "master". DOC_END
2022win343d-graph-samsyl916/.git/hooks/pre-commit.sample
#!/bin/sh # # An example hook script to verify what is about to be committed. # Called by "git commit" with no arguments. The hook should # exit with non-zero status after issuing an appropriate message if # it wants to stop the commit. # # To enable this hook, rename this file to "pre-commit". if git rev-parse –verify HEAD >/dev/null 2>&1 then against=HEAD else # Initial commit: diff against an empty tree object against=$(git hash-object -t tree /dev/null) fi # If you want to allow non-ASCII filenames set this variable to true. allownonascii=$(git config –type=bool hooks.allownonascii) # Redirect output to stderr. exec 1>&2 # Cross platform projects tend to avoid non-ASCII filenames; prevent # them from being added to the repository. We exploit the fact that the # printable range starts at the space character and ends with tilde. if [ "$allownonascii" != "true" ] && # Note that the use of brackets around a tr range is ok here, (it's # even required, for portability to Solaris 10's /usr/bin/tr), since # the square bracket bytes happen to fall in the designated range. test $(git diff –cached –name-only –diff-filter=A -z $against | LC_ALL=C tr -d '[ -~] ' | wc -c) != 0 then cat <<EOF Error: Attempt to add a non-ASCII file name. This can cause problems if you want to work with people on other platforms. To be portable it is advisable to rename the file. If you know what you are doing you can disable this check using: git config hooks.allownonascii true EOF exit 1 fi # If there are whitespace errors, print the offending file names and fail. exec git diff-index –check –cached $against —
2022win343d-graph-samsyl916/.git/hooks/applypatch-msg.sample
#!/bin/sh # # An example hook script to check the commit log message taken by # applypatch from an e-mail message. # # The hook should exit with non-zero status after issuing an # appropriate message if it wants to stop the commit. The hook is # allowed to edit the commit message file. # # To enable this hook, rename this file to "applypatch-msg". . git-sh-setup commitmsg="$(git rev-parse –git-path hooks/commit-msg)" test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} :
2022win343d-graph-samsyl916/.git/hooks/fsmonitor-watchman.sample
#!/usr/bin/perl use strict; use warnings; use IPC::Open2; # An example hook script to integrate Watchman # (https://facebook.github.io/watchman/) with git to speed up detecting # new and modified files. # # The hook is passed a version (currently 2) and last update token # formatted as a string and outputs to stdout a new update token and # all files that have been modified since the update token. Paths must # be relative to the root of the working tree and separated by a single NUL. # # To enable this hook, rename this file to "query-watchman" and set # 'git config core.fsmonitor .git/hooks/query-watchman' # my ($version, $last_update_token) = @ARGV; # Uncomment for debugging # print STDERR "$0 $version $last_update_tokenn"; # Check the hook interface version if ($version ne 2) { die "Unsupported query-fsmonitor hook version '$version'.n" . "Falling back to scanning…n"; } my $git_work_tree = get_working_dir(); my $retry = 1; my $json_pkg; eval { require JSON::XS; $json_pkg = "JSON::XS"; 1; } or do { require JSON::PP; $json_pkg = "JSON::PP"; }; launch_watchman(); sub launch_watchman { my $o = watchman_query(); if (is_work_tree_watched($o)) { output_result($o->{clock}, @{$o->{files}}); } } sub output_result { my ($clockid, @files) = @_; # Uncomment for debugging watchman output # open (my $fh, ">", ".git/watchman-output.out"); # binmode $fh, ":utf8"; # print $fh "$clockidn@filesn"; # close $fh; binmode STDOUT, ":utf8"; print $clockid; print "

