with recursive
  Pair(n1, n2) as (select n1, n2 from Edge
                   union
                   select Pair.n1, Edge.n2
                   from Pair, Edge
                   where Pair.n2 = Edge.n1)
select n1, n2 from Pair
where n1 in (select nID from Node where color = 'red')
  and n2 in (select nID from Node where color = 'red')
order by n1, n2;
