It works
This commit is contained in:
		
							parent
							
								
									dc29da26ee
								
							
						
					
					
						commit
						c1eb1f1127
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -35,3 +35,4 @@
 | 
			
		||||
# Building 
 | 
			
		||||
build
 | 
			
		||||
*.swp
 | 
			
		||||
.vs
 | 
			
		||||
 | 
			
		||||
@ -59,7 +59,7 @@ void PrintSolution(std::vector<Vertex*> solution) {
 | 
			
		||||
    std::cout << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::vector<Vertex*> UCBFS(Graph graph, int start) {
 | 
			
		||||
void UCBFS(Graph graph, int start) {
 | 
			
		||||
    std::queue<int> setds;
 | 
			
		||||
    std::vector<uint> dist(graph.nodeCount + 1, -1);
 | 
			
		||||
    setds.push(start);
 | 
			
		||||
@ -68,7 +68,6 @@ std::vector<Vertex*> UCBFS(Graph graph, int start) {
 | 
			
		||||
    {
 | 
			
		||||
        int tmp = setds.front();
 | 
			
		||||
        setds.pop();
 | 
			
		||||
        std::cout << "tmp: " << tmp << std::endl;
 | 
			
		||||
        for (Edge i : graph.vertices.at(tmp).edges)
 | 
			
		||||
        {
 | 
			
		||||
            int v = i.destination->nodeNumber;
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ struct Graph {
 | 
			
		||||
Graph ReadInGraph(std::string fileLocation);
 | 
			
		||||
void PrintSolution(std::vector<Vertex*> solution);
 | 
			
		||||
 | 
			
		||||
std::vector<Vertex*> UCBFS(Graph graph, int start);
 | 
			
		||||
void UCBFS(Graph graph, int start);
 | 
			
		||||
std::vector<Vertex*> BFS(Graph graph, int start, int end);
 | 
			
		||||
std::vector<Vertex*> DFS(Graph graph, int start, int end);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,12 +7,18 @@ int main(int argc, char* argv[]) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    Graph newGraph = ReadInGraph(argv[1]);
 | 
			
		||||
    std::cout << "BFS" << std::endl;
 | 
			
		||||
    std::cout << "---" << std::endl;
 | 
			
		||||
    for (int i = 1; i < newGraph.nodeCount + 1; i++) {
 | 
			
		||||
        PrintSolution(BFS(newGraph, 1, i));
 | 
			
		||||
    }
 | 
			
		||||
    std::cout << "DFS" << std::endl;
 | 
			
		||||
    std::cout << "---" << std::endl;
 | 
			
		||||
    for (int i = 1; i < newGraph.nodeCount + 1; i++) {
 | 
			
		||||
        PrintSolution(DFS(newGraph, 1, i));
 | 
			
		||||
    }
 | 
			
		||||
    PrintSolution(UCBFS(newGraph, 1));
 | 
			
		||||
    std::cout << "UCBFS" << std::endl;
 | 
			
		||||
    std::cout << "---" << std::endl;
 | 
			
		||||
    UCBFS(newGraph, 1);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,3 @@
 | 
			
		||||
find_package(Catch2 REQUIRED)
 | 
			
		||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
 | 
			
		||||
add_executable(testing 
 | 
			
		||||
    ./test-main.cpp
 | 
			
		||||
@ -6,4 +5,3 @@ add_executable(testing
 | 
			
		||||
    ../src/algorithm.cpp
 | 
			
		||||
)
 | 
			
		||||
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
 | 
			
		||||
target_link_libraries(testing Catch2::Catch2)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user