Tavirio
Tavirio

Reputation: 17

Trying to represent a Network using the "igraph" package on R, can't add a named independent node

So I'm trying to represent a large network that is composed of other smaller networks.

In order to do this I try and create each one of the networks individually with the intention of inserting them all into an object later on, an example of these sub networks:

USDA_APHIS <- graph(c("Paula Morales", "Mario Ambrosino"), directed = F)

I noticed that some of this sub networks are composed of a single node.

CARICOM <-graph(c("Shaun Baugh"))

I have no clue on how to represent those since I can't use this expression with a single object.

Does anyone have an idea on how to proceed? Is there amore efficient way to go about this?

Thanks in advance.

Upvotes: 0

Views: 49

Answers (1)

G5W
G5W

Reputation: 37641

You can create a graph with one vertex, by creating an empty graph and adding one vertex.

library(igraph)
g = make_empty_graph()
g = add.vertices(g, 1, name="Shaun Baugh")
plot(g)

Graph with one vertex

Upvotes: 1

Related Questions