title: An algorithm to check if 2 dogs x and y have the same breed given the list of assertions of the form R(x,y)
body: <p>I'm taking algorithms class this semester and we have a midterm coming up. There's a question on the past midterm. We are given a list of n dogs and a list of m assertions of the form R(x,y) which means x and y have the same breed. It's given that R is an equivalence relation. Given 2 dogs x and y, we need to formulate an algorithm to find if they have the same breed or not. 
  The most trivial way of doing this would be going over the list of assertions and checking if the pair (x,y) exists or not but that won't work in all the cases. </p>
  
  <p>Let's say we have Dogs = {a,b,c,d} and assertions = {(a,b),(b,d)}. We are asked to check if a and d have the same breed. What would be a good starting point for designing this algorithm?</p>