Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/levelgraph-recursive
Breadth-first and Deep-first for your LevelGraph
https://github.com/mcollina/levelgraph-recursive
Last synced: 2 months ago
JSON representation
Breadth-first and Deep-first for your LevelGraph
- Host: GitHub
- URL: https://github.com/mcollina/levelgraph-recursive
- Owner: mcollina
- License: isc
- Created: 2014-06-02T20:04:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-02T20:05:57.000Z (over 10 years ago)
- Last Synced: 2024-10-06T01:47:50.136Z (3 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 13
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LevelGraph-Recursive
====================Recursive searches for your LevelGraph
```js
var levelgraph = require('levelgraph')
, graph = levelgraph('mygraph')
, expect = require("must")graph = require('levelgraph-recursive')(graph)
graph.put([{
subject: 'origin'
, predicate: 'similar'
, object: 'a'
}, {
subject: 'a'
, predicate: 'similar'
, object: 'b'
}, {
subject: 'a'
, predicate: 'similar'
, object: 'c'
}, {
subject: 'c'
, predicate: 'similar'
, object: 'd'
}, {
subject: 'b'
, predicate: 'similar'
, object: 'dest'
}, {
subject: 'd'
, predicate: 'similar'
, object: 'dest'
}], function() {
graph.breadthFirst("origin", "similar", "dest", function(err, triple) {
expect(triple).to.eql({
subject: 'b'
, predicate: 'similar'
, object: 'dest' });
console.log('breadth first ok!')
})graph.deepFirst("origin", "similar", "dest", function(err, triple) {
expect(triple).to.eql({
subject: 'd'
, predicate: 'similar'
, object: 'dest' });
console.log('deep first ok!')
})
})
```License
-------ISC