zrygan / DSA-Project

Repository for CCDSALG Projects by Balcita, V., Ganituen, Z., and Jimenez, J.
0 stars 0 forks source link

Do the BFS and DFS in alphabetical order. #10

Closed zrygan closed 1 month ago

jazjimenez commented 1 month ago

Done. Check out line 51-61 in traversal_DFS.c.

// Recur for all the vertices adjacent to this vertex for (int small_index = 0; small_index < start_node->numNeighbors; small_index++) { // Get the unvisited lowest vertex ID for (int i = 0; i < start_node->numNeighbors; i++) { if (strcmp(temp,start_node->neighbors[i]->val) > 0 && !visited[i]) { strcpy(temp,start_node->neighbors[i]->val); small_index = i; } } dfs(start_node->neighbors[small_index], visited, values, numNodes); }