Thanks .
instead I want the output to be with doe.
lets say
library(igraph)
cnodes1=c(2,3,4,6)
cnodes2=c(1,57)
nodes=list(cnodes1, cnodes 2)
graph=g=graph_from_atlas(500)
#I would like to use the nodes to determine which would derive the highest sub-edges
v = V(g)[cnodes1]
E1 = which(sapply(E(g), function(e) ends(g, e)[1]) %in% v)
E2 = which(sapply(E(g), function(e) ends(g, e)[2]) %in% v)
Internal = intersect(E1, E2)
len=ends(g, Internal)
nrow(len)
v = V(g)[cnodes2]
E1 = which(sapply(E(g), function(e) ends(g, e)[1]) %in% v)
E2 = which(sapply(E(g), function(e) ends(g, e)[2]) %in% v)
Internal = intersect(E1, E2)
len2=ends(g, Internal)
nrow(len2)
if ((nrow(len2) > nrow(len1)) {
ans= cnodes2
}
else{
ans= cnodes1
}
return (ans)