Subqueries on graph