Checks for a vertex in R

Asked

Viewed 60 times

2

I am using igraph on R. I have the following graph:

inserir a descrição da imagem aqui

Is there any function in R, which returns me a boolean value, which verifies the existence of a vertex?

1 answer

1

The question is a little fuzzy, but this is what you’re looking for?

library(igraph)

g <- graph.full(n=10) # cria grafo completo, com 10 vertices

V(g) # 10 vertices numerados de 1 a 10

TRUE %in% (V(g) == 1) # o vertice 1 estah neste grafo?
[1] TRUE

TRUE %in% sum(V(g) == 15) # o vertice 15 estah neste grafo?
[1] FALSE

Browser other questions tagged

You are not signed in. Login or sign up in order to post.