Hi,
guys my question is simple, why when I created a graph with edges like 3-5 and 5-7, the vertices are 7?
#U: is a vector with the name of vertex like 2-3-5-7 and list_edges is useful to check a condition that I supposed
edges.U <- function(U, list.edges){
edges <- c()
`%notin%` <- Negate(`%in%`) #define new operator
for(row in 1:nrow(list.edges)){
if( (list.edges[row, 1] %in% U) && (list.edges[row, 2] %notin% U) ){
edges <- append(edges, c(list.edges[row, 1], list.edges[row, 2]) )
}
}
#here I created correctly the edges vector, in this case I had 3-5 and 5-7
subgraph.U <- graph(edges, U, directed=F) #####ERROR
return(subgraph.U)
}
In this case, why my vertices are wronged...?
How to set verteces with the function graph() by igraph?
kind regards, to the answer