- added helper method to check if a connection already exists between two nodes