Skip to content

Instantly share code, notes, and snippets.

@peterneubauer
Created March 13, 2010 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save peterneubauer/331581 to your computer and use it in GitHub Desktop.
Save peterneubauer/331581 to your computer and use it in GitHub Desktop.
$_g := neo4j:open('neodb.neo')
$bob := g:add-v(g:map('name','Bob'))
$john := g:add-v(g:map('name','John'))
$alice := g:add-v(g:map('name','Alice'))
$e1 := g:add-e($bob,'link',$john)
$e2 := g:add-e($john,'link',$alice)
$e3 := g:add-e($alice,'link',$bob)
$e1/weight := 10
$e2/weight := 1
$e3/weight := 20
$res := jung:pagerank(g:map('link',g:list('link'),'filter',true(),'alpha', 0.15, 'weight-key', 'weight'))
foreach $key in g:keys($res)
$key/@pagerank := g:get($res, $key)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment