Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for How to Find Friends by a.a.v.worker
def check_connection(network, first, second):
network = [set(f.split("-")) for f in network]
result = {first}
for pair in network:
if first in pair and second in pair: return True
for n in network:
if result & n: result |= n
return second in result
Aug. 15, 2015