add isConnected function

for now, it only checks for direct links, need to implement links for
paths also