Skip to content

Instantly share code, notes, and snippets.

@spmallette
Last active February 16, 2023 16:00
Show Gist options
  • Save spmallette/2f8181dee87928c99fc2dd1d1d7aabcc to your computer and use it in GitHub Desktop.
Save spmallette/2f8181dee87928c99fc2dd1d1d7aabcc to your computer and use it in GitHub Desktop.
g = TinkerGraph.open().traversal()
n1 = g.addV('A').property('id', '1').property('p', "node01").next()
n2 = g.addV('A').property('id', '2').property('p', 'node02').next()
n3 = g.addV('A').property('id', '3').property('p', 'node03').next()
n4 = g.addV('A').property('id', '4').property('p', 'node04').next()
n5 = g.addV('A').property('id', '5').property('p', 'node05').next()
n6 = g.addV('B').property('id', '6').property('p', 'node06').next()
n7 = g.addV('B').property('id', '7').property('p', 'node07').next()
n8 = g.addV('B').property('id', '8').property('p', 'node08').next()
n9 = g.addV('B').property('id', '9').property('p', 'node09').next()
n10 = g.addV('B').property('id', '10').property('p', 'node10').next()
g.addE('X').property('p', 'edge01').from(n1).to(n2).iterate()
g.addE('X').property('p', 'edge02').from(n2).to(n3).iterate()
g.addE('X').property('p', 'edge03').from(n3).to(n4).iterate()
g.addE('X').property('p', 'edge04').from(n4).to(n5).iterate()
g.addE('X').property('p', 'edge05').from(n5).to(n6).iterate()
g.addE('X').property('p', 'edge06').from(n6).to(n7).iterate()
g.addE('X').property('p', 'edge07').from(n7).to(n8).iterate()
g.addE('X').property('p', 'edge08').from(n8).to(n9).iterate()
g.addE('X').property('p', 'edge09').from(n9).to(n10).iterate()
g.addE('X').property('p', 'edge10').from(n10).to(n1).iterate()
g.addE('Y').property('p', 'edge11').from(n2).to(n1).iterate()
g.addE('Y').property('p', 'edge12').from(n3).to(n2).iterate()
g.addE('Y').property('p', 'edge13').from(n4).to(n3).iterate()
g.addE('Y').property('p', 'edge14').from(n5).to(n4).iterate()
g.addE('Y').property('p', 'edge15').from(n6).to(n5).iterate()
g.addE('Y').property('p', 'edge16').from(n7).to(n6).iterate()
g.addE('Y').property('p', 'edge17').from(n8).to(n7).iterate()
g.addE('Y').property('p', 'edge18').from(n9).to(n8).iterate()
g.addE('Y').property('p', 'edge19').from(n10).to(n9).iterate()
g.addE('Y').property('p', 'edge20').from(n1).to(n10).iterate()
g.addE('X').property('p', 'edge21').from(n3).to(n9).iterate()
g.addE('Y').property('p', 'edge22').from(n6).to(n3).iterate()
g.addE('Y').property('p', 'edge23').from(n1).to(n8).iterate()
g.addE('X').property('p', 'edge24').from(n2).to(n8).iterate()
g.addE('Y').property('p', 'edge25').from(n5).to(n8).iterate()
g.addE('X').property('p', 'edge26').from(n7).to(n3).iterate()
g.addE('Y').property('p', 'edge27').from(n9).to(n2).iterate()
g.addE('Y').property('p', 'edge28').from(n9).to(n6).iterate()
g.addE('X').property('p', 'edge29').from(n1).to(n6).iterate()
g.addE('Y').property('p', 'edge30').from(n2).to(n1).iterate()
g.addE('X').property('p', 'edge31').from(n1).to(n5).iterate()
g.addE('X').property('p', 'edge32').from(n2).to(n1).iterate()
g.addE('X').property('p', 'edge33').from(n3).to(n5).iterate()
g.addE('X').property('p', 'edge34').from(n4).to(n7).iterate()
g.addE('X').property('p', 'edge35').from(n5).to(n6).iterate()
g.addE('X').property('p', 'edge36').from(n6).to(n5).iterate()
g.addE('X').property('p', 'edge37').from(n7).to(n6).iterate()
g.addE('X').property('p', 'edge38').from(n8).to(n2).iterate()
g.addE('X').property('p', 'edge39').from(n9).to(n7).iterate()
g.addE('X').property('p', 'edge40').from(n10).to(n3).iterate()
g.addE('Y').property('p', 'edge41').from(n2).to(n1).iterate()
g.addE('Y').property('p', 'edge42').from(n8).to(n2).iterate()
g.addE('Y').property('p', 'edge43').from(n9).to(n3).iterate()
g.addE('Y').property('p', 'edge44').from(n9).to(n4).iterate()
g.addE('Y').property('p', 'edge45').from(n2).to(n5).iterate()
g.addE('Y').property('p', 'edge46').from(n7).to(n6).iterate()
g.addE('Y').property('p', 'edge47').from(n6).to(n7).iterate()
g.addE('Y').property('p', 'edge48').from(n3).to(n8).iterate()
g.addE('Y').property('p', 'edge49').from(n1).to(n9).iterate()
g.addE('Y').property('p', 'edge50').from(n7).to(n10).iterate()
g.V().as('x').hasLabel('A').bothE().dedup().otherV().select('x').count()
g.V().as('x').bothE().dedup().otherV().select('x').hasLabel('A').count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment