Home > database >  Gremlin vertex programs / graph computers using Gremlin.Net?
Gremlin vertex programs / graph computers using Gremlin.Net?

Time:02-22

Are vertex programs / graph computers supported by Gremlin.Net? Or is it only supported on JVM Gremlin implementations?

CodePudding user response:

You cannot write a VertexProgram in Gremlin.NET. Those must be written in Java. You could however execute that JVM-written VertexProgram with .NET if you submit a script with your traversal referencing that program. There is an example of that approach here with more details, but I'll paste some code here:

gremlin> result = graph.compute().program(PageRankVertexProgram.build().create()).submit().get()
==>result[tinkergraph[vertices:6 edges:0],memory[size:0]]
gremlin> g = traversal().withEmbedded(result.graph())
==>graphtraversalsource[tinkergraph[vertices:6 edges:0], standard]
gremlin> g.V().elementMap()
==>[id:1,label:person,gremlin.pageRankVertexProgram.pageRank:0.11375510357865541,name:marko,age:29]
==>[id:2,label:person,gremlin.pageRankVertexProgram.pageRank:0.14598540152719106,name:vadas,age:27]
==>[id:3,label:software,gremlin.pageRankVertexProgram.pageRank:0.3047200907912249,name:lop,lang:java]
==>[id:4,label:person,gremlin.pageRankVertexProgram.pageRank:0.14598540152719106,name:josh,age:32]
==>[id:5,label:software,gremlin.pageRankVertexProgram.pageRank:0.17579889899708231,name:ripple,lang:java]
==>[id:6,label:person,gremlin.pageRankVertexProgram.pageRank:0.11375510357865541,name:peter,age:35]
  • Related