-- vytvoreni databaze graph = TinkerGraph.open() g = graph.traversal() sf = g.addV().property("name","San Francisco").property("code","sf").next() la = g.addV().property("name","Los Angeles").property("code","la").next() da = g.addV().property("name","Dallas").property("code","da").next() ch = g.addV().property("name","Chicago").property("code","ch").next() ny = g.addV().property("name","New York").property("code","ny").next() g.addE("direct").from(sf).to(la).property("price",50) g.addE("direct").from(la).to(sf).property("price",50) g.addE("direct").from(sf).to(ch).property("price",275) g.addE("direct").from(ch).to(sf).property("price",275) g.addE("direct").from(da).to(sf).property("price",300) g.addE("direct").from(sf).to(da).property("price",300) g.addE("direct").from(ch).to(da).property("price",100) g.addE("direct").from(da).to(ch).property("price",100) g.addE("direct").from(ch).to(ny).property("price",250) g.addE("direct").from(ny).to(ch).property("price",250) g.addE("direct").from(ny).to(da).property("price",225) g.addE("direct").from(da).to(ny).property("price",225) g.addE("direct").from(da).to(la).property("price",200) g.addE("direct").from(la).to(da).property("price",200) -- uzel s codem 'sf' g.V().has('code','sf') -- názvy letišt dosažitelných ze San Francisca s jedním přestupem g.V().has('code','sf').out('direct').out('direct').V().values('name') -- prvním deset cest začínající v San Francisu a končící v New Yorku g.V().has('code','sf'). repeat(out().simplePath()).until(has('code','ny')). path().by('code').limit(10) -- tři nejlevnější cesty ze San Francisca do New Yourku g.V().has('code','sf'). repeat(outE().inV().simplePath()).until(has('code','ny')). project('path','total'). by(path().by('code').by('price')). by(path().unfold().values('price').sum()). order().by(select('total')). limit(3)