Check to see if any of the senders direct neighbours is the receiver.
If not, check to see if any of neighbours neighbours is the receiver.
Keep doing this until there is a match.
Else no match.
-If there is a match, also store the path - who is directly connected to whom?
-That way in the end, you just have to go back the path from receiver to sender.
The code below could be cleaned up more.. But here it is.
Logic:
-If there is a match, also store the path - who is directly connected to whom?
-That way in the end, you just have to go back the path from receiver to sender.
The code below could be cleaned up more.. But here it is.