Skip to content

Instantly share code, notes, and snippets.

@mzsima
Created May 27, 2020 16:13
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 mzsima/8736e27a597bdcd0262b5a43a8077aad to your computer and use it in GitHub Desktop.
Save mzsima/8736e27a597bdcd0262b5a43a8077aad to your computer and use it in GitHub Desktop.
linked list

image

snapshot

code gremlin

schema.vertexLabel("Node").ifNotExists().partitionBy("id", Text).property("value", Text).create();
schema.edgeLabel('next').ifNotExists().from('Node').to('Node').create()
schema.edgeLabel('prev').ifNotExists().from('Node').to('Node').create()
  
  
Nil = g.addV("Node").property("id", "nil").property("value", "nil").next();
A = g.addV("Node").property("id", "a").property("value", "A").next();
B = g.addV("Node").property("id", "b").property("value", "B").next();
C = g.addV("Node").property("id", "c").property("value", "C").next();

g.addE("next").from(Nil).to(A).next();
g.addE("next").from(A).to(B).next();
g.addE("next").from(B).to(C).next();
g.addE("next").from(C).to(Nil).next();

g.addE("prev").from(A).to(Nil).next();
g.addE("prev").from(B).to(A).next();
g.addE("prev").from(C).to(B).next();
g.addE("prev").from(Nil).to(C).next();

dev.V()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment