Skip to content

Instantly share code, notes, and snippets.

@schmurfy
Created July 17, 2014 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmurfy/0dbf7cd3da530f47da19 to your computer and use it in GitHub Desktop.
Save schmurfy/0dbf7cd3da530f47da19 to your computer and use it in GitHub Desktop.
function getInRange(origin_id, range, ret){
if( range > 0 ){
g.V(origin_id).Both("gate_to").ForEach(function(n){
var system_name = g.V(n["id"]).Out("name").ToValue();
if( ret.indexOf(system_name) == -1 ){
ret.push( system_name )
getInRange(n["id"], range - 1, ret)
}
})
}
}
var node_id = g.V("SystemA").In("name").ToValue()
ret = []
getInRange( node_id, 1, ret)
g.Emit({"ret" : ret.sort()})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment