Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > Find all direct connections between any airport in Poland and any airport in Germany. For each connection show the airports and the distance between them.
- g.V().has("country", "PL").as("a").bothE().as("edge").otherV().has("country", "DE").as("b").path().by("code").by("dist")
- > Find all direct connections between any airport in Poland and any airport in Germany such that the distance between the airports is greater that 400 miles. For each connection show the airports and the distance between them.
- g.V().has("country", "PL").as("a").bothE().where(values("dist").is(gt(400))).as("edge").otherV().has("country", "DE").as("b").path().by("code").by("dist")
- Find all direct connections between any airport in Poland that has a connection to Munich and any airport in Germany. For each connection show the airports and the distance between them.
- g.V().has("country", "PL").as("a").where(out().id().is(80)).bothE().as("edge").otherV().has("country", "DE").as("b").path().by("code").by("dist")
- What are the airports in UK (United Kingdom) you can reach from Wrocław with at most four stops? For each connection show all the airports including the intermediate ones.
- g.V().has("city", "Wroclaw").repeat(out()).emit().times(4).has("country", "UK").path().by("code")
- > What are the airports in UK you can reach from Wrocław with at most four stops within UK? For each connection show all the airports including the intermediate ones.
- g.V().has("city", "Wroclaw").repeat(out().has("country","UK")).emit().times(4).has("country", "UK").path().by("code")
- > What are the codes of the airports in UK you cannot reach from Wrocław with at most four stops. Hint: e.g., you can use - (minus) operator on lists.
- xs = []
- g.V().has("city", "Wroclaw").repeat(out()).emit().times(4).has("country", "UK").values("code").dedup().fill(xs)
- g.V().and(has("country", "UK"), has("code", without(xs))).values("code")
- > For each polish airport return the numbers of incoming and outgoing direct connections. Sort the result w.r.t. the first number.
- def degree(g,s) {
- v = g.V().has('code',s).next();
- o=g.V(v).out().count().next();
- i=g.V(v).in().count().next();
- println s;
- println "Edges in : " + i;
- println "Edges out : " + o;
- println "Total : " +(i+o);
- }
- pl = []
- g.V().has("country", "PL").values("code").fill(pl)
- for (s in pl){degree(g,s);}
- sort...
- > For each polish airport return the list of directly connected countries.
- def cont(g,s){
- println s;
- x = [];
- g.V().has("code",s).out().values("country").dedup().fill(x);
- println x;
- }
- for (s in pl){
- cont(g,s);
- }
- > Find ten European airports that have the biggest number of outgoing direct connections. For each of them return the airport code, city and the number of connections.
- g.V().has("code", "EU").out().as("airport").out().select("airport").groupCount().by("code").order(local).by(values, decr).limit(local, 10).select(keys).unfold()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement