check if source and target nodes exist