Skip to content

Instantly share code, notes, and snippets.

@spmallette
Created December 1, 2011 20:48
Show Gist options
  • Save spmallette/1419739 to your computer and use it in GitHub Desktop.
Save spmallette/1419739 to your computer and use it in GitHub Desktop.
GraphSON to JIT
var jitJson = _(graphson.graph.vertices).map(function (v, key) {
return {
id: v._id,
name: v[nameKey],
data: v,
adjacencies: _(graphson.graph.edges).filter(function (e) { return e._outV == v._id }).map(function (edge, key) {
return {
nodeTo: edge._inV,
data: edge
};
})
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment