Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if 2 vertices are connected in Igraph for R

Tags:

r

igraph

what are the functions which check if two vertices (specified by their name attribute) are connected by an edge (incoming or outgoing or both) or not? in other words what are the name of the functions get_eid and are_connected of python in igraph in R ?

thank you in advance,

like image 861
academic.user Avatar asked May 05 '15 20:05

academic.user


1 Answers

There is an are.connected() function in R's igraph library

g <- graph.ring(10)
are.connected(g, 1, 2)
# [1] TRUE
are.connected(g, 2, 4)
# [1] FALSE

for a list functions in the package, you can try looking at help(package="igraph") in the future.

like image 158
MrFlick Avatar answered Oct 20 '22 02:10

MrFlick