# 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
• 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
#include
#include
#include
#include

#include
#include
#include
#include
using namespace std;
// constructor, empty graph
// directionalEdges defaults to true
Graph::Graph(bool directionalEdges) {}
// destructor
Graph::~Graph() {}
int Graph::verticesSize() const { return 0; }
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>
Graph::dijkstra(const string &startLabel) const {
map weights;
map previous;
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
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
&

:
mp
)

{

out
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
WarningsAsErrors: ‘*’
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
# -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
# Using pointers to arrays
# -cppcoreguidelines-pro-bounds-pointer-arithmetic,
# Not using which is in C++20
# 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”
# 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()
# Readability, want to have “using namespace std;” in headers as well
# -cppcoreguidelines-avoid-magic-numbers
# When testing we use magic numbers
# When testing we use magic numbers
# 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
– 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

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

#include
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
// @return true if vertex is in the graph
bool contains(const string &label) const;
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);
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;
// 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
// 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>
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

# 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 “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
*.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
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
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
^~~~~~~~~~~~~~~~~~~~~~~~
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(‘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 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 weights;
^~~~~~~
Weights
/Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:170:23: warning: invalid case style for variable ‘previous’ [readability-identifier-naming]
map 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, greater> pq;
^~
Pq
/Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:176:17: warning: invalid case style for variable ‘vertexSet’ [readability-identifier-naming]
set 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 mstVertices;
^~~~~~~~~~~
MstVertices
/Users/yusuf/bitbucket/pisan343/graph-solution/graph.cpp:220:53: warning: invalid case style for variable ‘potentials’ [readability-identifier-naming]
priority_queue, greater> 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]
^~~~~~~~
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]
^~~~~~~~
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 edges;
^~~~~
Edges
Suppressed 88380 warnings (88379 in non-user code, 1 NOLINT).
=====================================================
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

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
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
ignorecase = true
precomposeunicode = true
[submodule]
active = .
[remote “origin”]
url = https://github.com/uwbclass/2022win343d-graph-samsyl916.git
[branch “master”]
remote = origin

__MACOSX/2022win343d-graph-samsyl916/.git/._objects

__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
# 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]
# *~

0000000000000000000000000000000000000000 edd34264e9d5bbba90854ea9f3ee6f02ff139475 samsyl916 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
else
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case “\$topic” in
;;
*)
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
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 ‘[ -~]\0’ | 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_token\n"; # 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 “\$clockid\n@files\n”;
# close \$fh;
binmode STDOUT, “:utf8”;
print \$clockid;
print “\0”;
local \$, = “\0”;
print @files;
}
sub watchman_clock {
my \$response = qx/watchman clock “\$git_work_tree”/;
die “Failed to get clock id on ‘\$git_work_tree’.\n” .
“Falling back to scanning…\n” if \$? != 0;
return \$json_pkg->new->utf8->decode(\$response);
}
sub watchman_query {
my \$pid = open2(\*CHLD_OUT, \*CHLD_IN, ‘watchman -j –no-pretty’)
or die “open2() failed: \$!\n” .
“Falling back to scanning…\n”;
# In the query expression below we’re asking for names of files that
# changed since \$last_update_token but not from the .git folder.
#
# To accomplish this, we’re using the “since” generator to use the
# recency index to select candidate nodes and “fields” to limit the
# output to file names only. Then we’re using the “expression” term to
# further constrain the results.
if (substr(\$last_update_token, 0, 1) eq “c”) {
\$last_update_token = “\”\$last_update_token\””;
}
my \$query = <<" END"; ["query", "\$git_work_tree", { "since": \$last_update_token, "fields": ["name"], "expression": ["not", ["dirname", ".git"]] }] END # Uncomment for debugging the watchman query # open (my \$fh, ">“, “.git/watchman-query.json”);
# print \$fh \$query;
# close \$fh;
print CHLD_IN \$query;
close CHLD_IN;
my \$response = do {local \$/; };
# Uncomment for debugging the watch response
# open (\$fh, “>”, “.git/watchman-response.json”);
# print \$fh \$response;
# close \$fh;
die “Watchman: command returned no output.\n” .
“Falling back to scanning…\n” if \$response eq “”;
die “Watchman: command returned invalid output: \$response\n” .
“Falling back to scanning…\n” unless \$response =~ /^\{/;
return \$json_pkg->new->utf8->decode(\$response);
}
sub is_work_tree_watched {
my (\$output) = @_;
my \$error = \$output->{error};
if (\$retry > 0 and \$error and \$error =~ m/unable to resolve root .* directory (.*) is not watched/) {
\$retry–;
my \$response = qx/watchman watch “\$git_work_tree”/;
die “Failed to make watchman watch ‘\$git_work_tree’.\n” .
“Falling back to scanning…\n” if \$? != 0;
\$output = \$json_pkg->new->utf8->decode(\$response);
\$error = \$output->{error};
die “Watchman: \$error.\n” .
“Falling back to scanning…\n” if \$error;
# Uncomment for debugging watchman output
# open (my \$fh, “>”, “.git/watchman-output.out”);
# close \$fh;
# Watchman will always return all files on the first query so
# return the fast “everything is dirty” flag to git and do the
# Watchman query just to get it over with now so we won’t pay
# the cost in git to look up each individual file.
my \$o = watchman_clock();
\$error = \$output->{error};
die “Watchman: \$error.\n” .
“Falling back to scanning…\n” if \$error;
output_result(\$o->{clock}, (“/”));
\$last_update_token = \$o->{clock};
eval { launch_watchman() };
return 0;
}
die “Watchman: \$error.\n” .
“Falling back to scanning…\n” if \$error;
return 1;
}
sub get_working_dir {
my \$working_dir;
if (\$^O =~ ‘msys’ || \$^O =~ ‘cygwin’) {
\$working_dir = Win32::GetCwd();
\$working_dir =~ tr/\\/\//;
} else {
require Cwd;
\$working_dir = Cwd::cwd();
}
return \$working_dir;
}

#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with ‘echoback=’
# and rejects all pushes when the “reject” push option is used.
#
# To enable this hook, rename this file to “pre-receive”.
if test -n “\$GIT_PUSH_OPTION_COUNT”
then
i=0
while test “\$i” -lt “\$GIT_PUSH_OPTION_COUNT”
do
eval “value=\\$GIT_PUSH_OPTION_\$i”
case “\$value” in
echoback=*)
echo “echo from the pre-receive-hook: \${value#*=}” >&2
;;
reject)
exit 1
esac
i=\$((i + 1))
done
fi

2022win343d-graph-samsyl916/.git/hooks/prepare-commit-msg.sample
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by “git commit” with the name of the file that has the
# commit message, followed by the description of the commit
# message’s source. The hook’s purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to “prepare-commit-msg”.
# This hook includes three examples. The first one removes the
# “# Please enter the commit message…” help message.
#
# The second includes the output of “git diff –name-status -r”
# into the message, just before the “git status” output. It is
# commented because it doesn’t cope with –amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=\$1
COMMIT_SOURCE=\$2
SHA1=\$3
/usr/bin/perl -i.bak -ne ‘print unless(m/^. Please enter the commit message/..m/^#\$/)’ “\$COMMIT_MSG_FILE”
# case “\$COMMIT_SOURCE,\$SHA1” in
# ,|template,)
# /usr/bin/perl -i.bak -pe ‘
# print “\n” . `git diff –cached –name-status -r`
# if /^#/ && \$first++ == 0’ “\$COMMIT_MSG_FILE” ;;
# *) ;;
# esac
# SOB=\$(git var GIT_COMMITTER_IDENT | sed -n ‘s/^\(.*>\).*\$/Signed-off-by: \1/p’)
# git interpret-trailers –in-place –trailer “\$SOB” “\$COMMIT_MSG_FILE”
# if test -z “\$COMMIT_SOURCE”
# then
# /usr/bin/perl -i.bak -pe ‘print “\n” if !\$first_line++’ “\$COMMIT_MSG_FILE”
# fi

2022win343d-graph-samsyl916/.git/hooks/post-update.sample
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to “post-update”.
exec git update-server-info

2022win343d-graph-samsyl916/.git/hooks/pre-merge-commit.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by “git merge” with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to “pre-merge-commit”.
. git-sh-setup
test -x “\$GIT_DIR/hooks/pre-commit” &&
exec “\$GIT_DIR/hooks/pre-commit”
:

2022win343d-graph-samsyl916/.git/hooks/pre-applypatch.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# 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.
#
# To enable this hook, rename this file to “pre-applypatch”.
. git-sh-setup
precommit=”\$(git rev-parse –git-path hooks/pre-commit)”
test -x “\$precommit” && exec “\$precommit” \${1+”\$@”}
:

2022win343d-graph-samsyl916/.git/hooks/pre-push.sample
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by “git
# push” after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# \$1 — Name of the remote to which the push is being done
# \$2 — URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
#
#
# This sample shows how to prevent push of commits where the log message starts
# with “WIP” (work in progress).
remote=”\$1″
url=”\$2″
zero=\$(git hash-object –stdin &2 “Found WIP commit in \$local_ref, not pushing”
exit 1
fi
fi
done
exit 0

2022win343d-graph-samsyl916/.git/hooks/update.sample
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by “git receive-pack” with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to “update”.
#
# Config
# ——
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won’t be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won’t be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won’t be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won’t be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# — Command line
refname=”\$1″
oldrev=”\$2″
newrev=”\$3″
# — Safety check
if [ -z “\$GIT_DIR” ]; then
echo “Don’t run this script from the command line.” >&2
echo ” (if you want, you could supply GIT_DIR then run” >&2
echo ” \$0 )” >&2
exit 1
fi
if [ -z “\$refname” -o -z “\$oldrev” -o -z “\$newrev” ]; then
echo “usage: \$0 ” >&2
exit 1
fi
# — Config
allowunannotated=\$(git config –type=bool hooks.allowunannotated)
allowdeletebranch=\$(git config –type=bool hooks.allowdeletebranch)
denycreatebranch=\$(git config –type=bool hooks.denycreatebranch)
allowdeletetag=\$(git config –type=bool hooks.allowdeletetag)
allowmodifytag=\$(git config –type=bool hooks.allowmodifytag)
# check for no description
projectdesc=\$(sed -e ‘1q’ “\$GIT_DIR/description”)
case “\$projectdesc” in
“Unnamed repository”* | “”)
echo “*** Project description file hasn’t been set” >&2
exit 1
;;
esac
# — Check types
# if \$newrev is 0000…0000, it’s a commit to delete a ref.
zero=\$(git hash-object –stdin &2
echo “*** Use ‘git tag [ -a | -s ]’ for tags you want to propagate.” >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ “\$allowdeletetag” != “true” ]; then
echo “*** Deleting a tag is not allowed in this repository” >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ “\$allowmodifytag” != “true” ] && git rev-parse \$refname > /dev/null 2>&1
then
echo “*** Tag ‘\$refname’ already exists.” >&2
echo “*** Modifying a tag is not allowed in this repository.” >&2
exit 1
fi
;;
# branch
if [ “\$oldrev” = “\$zero” -a “\$denycreatebranch” = “true” ]; then
echo “*** Creating a branch is not allowed in this repository” >&2
exit 1
fi
;;
# delete branch
if [ “\$allowdeletebranch” != “true” ]; then
echo “*** Deleting a branch is not allowed in this repository” >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ “\$allowdeletebranch” != “true” ]; then
echo “*** Deleting a tracking branch is not allowed in this repository” >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo “*** Update hook: unknown type of update to ref \$refname of type \$newrev_type” >&2
exit 1
;;
esac
# — Finished
exit 0

2022win343d-graph-samsyl916/.git/hooks/push-to-checkout.sample
#!/bin/sh
# An example hook script to update a checked-out tree on a git push.
#
# This hook is invoked by git-receive-pack(1) when it reacts to git
# push and updates reference(s) in its repository, and when the push
# tries to update the branch that is currently checked out and the
# receive.denyCurrentBranch configuration variable is set to
#
# By default, such a push is refused if the working tree and the index
# of the remote repository has any difference from the currently
# checked out commit; when both the working tree and the index match
# the current commit, they are updated to match the newly pushed tip
# of the branch. This hook is to be used to override the default
# behaviour; however the code below reimplements the default behaviour
# as a starting point for convenient modification.
#
# The hook receives the commit with which the tip of the current
# branch is going to be updated:
commit=\$1
# It can exit with a non-zero status to refuse the push (when it does
# so, it must not modify the index or the working tree).
die () {
echo >&2 “\$*”
exit 1
}
# Or it can make any necessary changes to the working tree and to the
# index to bring them to the desired state when the tip of the current
# branch is updated to the new commit, and exit with a zero status.
#
# For example, the hook can simply run git read-tree -u -m HEAD “\$1”
# in order to emulate git fetch that is run in the reverse direction
# with git push, as the two-tree form of git read-tree -u -m is
# essentially the same as git switch or git checkout that switches
# branches while keeping the local changes in the working tree that do
# not interfere with the difference between the branches.
# The below is a more-or-less exact translation to shell of the C code
# for the default behaviour for git’s push-to-checkout hook defined in
# the push_to_deploy() function in builtin/receive-pack.c.
#
# Note that the hook will be executed from the repository directory,
# not from the working tree, so if you want to perform operations on
# the working tree, you will have to adapt your code accordingly, e.g.
# by adding “cd ..” or using relative paths.
if ! git update-index -q –ignore-submodules –refresh
then
die “Up-to-date check failed”
fi
if ! git diff-files –quiet –ignore-submodules —
then
die “Working directory has unstaged changes”
fi
# This is a rough translation of:
#
if git cat-file -e HEAD 2>/dev/null
then
else
head=\$(git hash-object -t tree –stdin 1643535245 -0800 clone: from https://github.com/uwbclass/2022win343d-graph-samsyl916.git

__MACOSX/2022win343d-graph-samsyl916/.git/logs/refs/remotes/._origin

ref: refs/remotes/origin/master

0000000000000000000000000000000000000000 edd34264e9d5bbba90854ea9f3ee6f02ff139475 samsyl916 1643535245 -0800 clone: from https://github.com/uwbclass/2022win343d-graph-samsyl916.git

Order your essay today and save 25% with the discount code: GREEN

## Order a unique copy of this paper

600 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26