Is there a way to automate connections on RStudio?

I have used igraph package to show connections on a network and I was wondering if there is a way to automate connections between two nodes?
TIA