Skip to content

Commit

Permalink
included boost library
Browse files Browse the repository at this point in the history
  • Loading branch information
djryn committed Mar 28, 2022
1 parent 8902c7e commit 7510c46
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/22s-pa03-girvan-newman-sanasimps.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ project(22s_pa03)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS_RELEASE -O3)

set(BOOST_ROOT "/usr/local/Cellar/boost/1.78.0_1/include")
find_package(Boost 1.78.0)
include_directories(${BOOST_ROOT})

#set(1 file1)

#foreach(file IN LISTS 1)
Expand Down
45 changes: 37 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,46 @@
//

#include <iostream>
#include <utility>
#include <algorithm>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>

using namespace std;

int main(int argc, char** argv) {
cout << "Hello CS3353, your arguments were: ";
for (int i = 1; i < argc; i++) {
cout << argv[i];
if (i < argc - 1)
cout << ", ";
}
cout << endl << endl;
// cout << "Hello CS3353, your arguments were: ";
// for (int i = 1; i < argc; i++) {
// cout << argv[i];
// if (i < argc - 1)
// cout << ", ";
// }
// cout << endl << endl;
//
// return 0;


// create a typedef for the Graph type
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS> Graph;

// Make convenient labels for the vertices
enum { A, B, C, D, E, N };
const int num_vertices = N;
const char* name = "ABCDE";

// writing out the edges in the graph
typedef std::pair<int, int> Edge;
Edge edge_array[] =
{ Edge(A,B), Edge(A,D), Edge(C,A), Edge(D,C),
Edge(C,E), Edge(B,D), Edge(D,E) };
const int num_edges = sizeof(edge_array)/sizeof(edge_array[0]);

// declare a graph object
Graph g(num_vertices);

// add the edges to the graph object
for (int i = 0; i < num_edges; ++i)
add_edge(edge_array[i].first, edge_array[i].second, g);

return 0;
}

0 comments on commit 7510c46

Please sign in to comment.