Skip to content

Commit

Permalink
Manual cleanup of bfs_order.js
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Jan 2, 2021
1 parent 11f22cf commit ad0a501
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/bfs_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { bfs } from './bfs';
export const bfs_order = (graph, comps) => {
if (!comps) comps = graph.components();

let i;
let comp;
const order = [];

for (i = 0; i < comps.length; i++) {
comp = comps[i];
for (let i = 0; i < comps.length; i++) {
const comp = comps[i];
bfs(graph, comp[0], (v, c) => {
if (c >= 0 && v != c) order.push(v);
});
}

return order;
};

0 comments on commit ad0a501

Please sign in to comment.