Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other traversal algorithms #13

Open
dominicbarnes opened this issue Oct 20, 2015 · 2 comments
Open

Other traversal algorithms #13

dominicbarnes opened this issue Oct 20, 2015 · 2 comments

Comments

@dominicbarnes
Copy link
Contributor

Do any of the methods here accomplish either a depth-first or breadth-first traversal directly? It doesn't seem like that is the case, although there are clearly other algorithms sprinkled in.

If they are not included, is it because they are not difficult to implement by hand?

@dominicbarnes
Copy link
Contributor Author

Just searching around, I've come to discover a lot more tree traversal algorithms.

I suppose issue is similar to (if not an outright duplicated of) #8. Do you think this library will expose some sort of "plugin" infrastructure to add different algorithms? Or are you thinking that these libraries are standalone?

var Graph = require('graph.js');
var DFT = require('depth-first-traversal');

var graph = new Graph();

// standalone
DFT(graph, function (key, value) {
  // visit vertex
});

// plugin
graph.use(DFT);
graph.walk('depth-first', function (key, value) {
  // visit vertex
});

@mhelvens
Copy link
Owner

Probably both.

DFT(graph, () => { ... });
Graph.plugin(DFT);
graph.DFT(() => { ... });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants