with recursive
  Pair(n1, n2, length) 
  as (select n1, n2, 1 from Edge
      union
      select Pair.n1, Edge.n2, Pair.length+1
      from Pair, Edge
      where Pair.n2 = Edge.n1)
select n1, n2, min(length), max(length) from Pair
where n1 in (select nID from Node
             where color = 'blue')
  and n2 in (select nID from Node
             where color = 'blue')
group by n1, n2;
