I realise this is old but just in case anyone else finds this post whilst trying to solve this problem themselves, the answer is in this thread - Graphl query problem
I realise this is old but just in case anyone else finds this post whilst trying to solve this problem themselves, the answer is in this thread - Graphl query problem