Schema

Untitled

Esercizio 1

Find all Pokemon

MATCH (p:Pokemon) RETURN p;

Esercizio 2

Find all Pokemon by limiting the displayed results to 10

MATCH (p:Pokemon) RETURN p LIMIT 10;

Esercizio 3

Extract the subgraph of the Pokemon through their mega evolution, arriving at the type

MATCH (p:Pokemon)-[:MEGA_EVOLVE]->(f:MegaEvolution)-[:IS]-(t:Type)
RETURN p, f, t

Esercizio 4

Starting from the Pokemon “Charmander”, find the shortest path to get to the type “Dragon”. Docs of shortest path here if needed

MATCH (c:Pokemon{name: "Charmander"}), 
(t:Type{name: "Dragon"}),
sp = shortestPath((c)-[*]-(t))
RETURN sp

Esercizio 5

Find how many Pokemon there are of each type

MATCH (type: Type)-[:IS]-(pokemon: Pokemon)
WITH type, count(pokemon) as quantity
RETURN type.name, quantity
ORDER BY quantity DESC

Simpler alternative

MATCH (type: Type)-[:IS]-(pokemon: Pokemon)
WITH type, count(pokemon) as quantity
ORDER BY quantity DESC

Esercizio 6