Answer:

related([], i, j) => 0; 
related([S | More], i, j) => member(i, S) ? member(j, S); 
related([_ | More], i, j) => related(More, i, j); 
Alternate Answer (using higher-order functions): 
related(P, i, j) = 
  S = find((L)=>member(i, L), P), 
  S == [] ? 0 : member(j, first(S));