I'm building a graph network of rivers. So far, I've created a networkx graph of lat/lon points on rivers. Each river has edges between it's points. However, no edges exist between different rivers in my dataset. Now I want to connect rivers that geographically intersect, so for example here:

I want to add an edge at the red arrow between the end node on the Missouri river and the nearest node on the Mississippi river.
How can this be accomplished? I could iterate through every pair of nodes, calculate their great-circle distance, and add an edge if it's under the distance limit. This could work but seems slow and I wonder if there's a more built-in way to do this?

scipy.spatial.KDTree.query_ball_pointto efficiently find all other nodes within a specified distance. Then select the nearest node that is not part of the same component as the leaf.