MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / BFS

Method BFS

deps/glomap/glomap/scene/view_graph.cc:92–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void ViewGraph::BFS(image_t root,
93 std::unordered_map<image_t, bool>& visited,
94 std::unordered_set<image_t>& component) {
95 std::queue<image_t> q;
96 q.push(root);
97 visited[root] = true;
98 component.insert(root);
99
100 while (!q.empty()) {
101 image_t curr = q.front();
102 q.pop();
103
104 for (image_t neighbor : adjacency_list[curr]) {
105 if (!visited[neighbor]) {
106 q.push(neighbor);
107 visited[neighbor] = true;
108 component.insert(neighbor);
109 }
110 }
111 }
112}
113
114void ViewGraph::EstablishAdjacencyList() {
115 adjacency_list.clear();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected