Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brian-gates/neo4j-to-js-graph
Neo4j graph results as JavaScript data structures
https://github.com/brian-gates/neo4j-to-js-graph
Last synced: 13 days ago
JSON representation
Neo4j graph results as JavaScript data structures
- Host: GitHub
- URL: https://github.com/brian-gates/neo4j-to-js-graph
- Owner: brian-gates
- Created: 2014-11-04T17:53:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-04T20:03:49.000Z (about 10 years ago)
- Last Synced: 2024-11-07T14:43:40.518Z (2 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Neo4j to JS Graph
Convert neo4j graph responses to a traversable [Graph](https://github.com/chenglou/data-structures/wiki/Graph) object.
See example.js:
``` js
var response = require('./mock-response');
var util = require('util');
var graphify = require('../index');var graph = graphify(response.results[0]);
console.log(util.inspect(graph, { depth: null }));
```
Would output:
``` js
{ _nodes:
{ '16':
{ _outEdges:
{ '17': { weight: 1, type: 'HAS', properties: { position: 1 }, id: '9' },
'18': { weight: 1, type: 'HAS', properties: { position: 2 }, id: '10' } },
_inEdges: {},
labels: [ 'Bike' ],
properties: { weight: 10 } },
'17':
{ _outEdges: {},
_inEdges: { '16': { weight: 1, type: 'HAS', properties: { position: 1 }, id: '9' } },
labels: [ 'Wheel' ],
properties: { spokes: 3 } },
'18':
{ _outEdges: {},
_inEdges: { '16': { weight: 1, type: 'HAS', properties: { position: 2 }, id: '10' } },
labels: [ 'Wheel' ],
properties: { spokes: 32 } } },
nodeSize: 3,
edgeSize: 2 }```