Nathalie
Nathalie

Reputation: 1238

Create a fully connected graph

How is it possible to create a fully undirected graph with 5 nodes?

Using the igraphe package for exampple

library(igraph)
nodes <- c("A", "B", "C", "D", "E")    

Upvotes: 0

Views: 241

Answers (1)

G. Grothendieck
G. Grothendieck

Reputation: 270268

Use make_full_graph. Can use label in place of name if desired.

g <- make_full_graph(6)
vertex_attr(g, "name") <- head(LETTERS)
plot(g)

or

plot(make_full_graph(6), vertex.name = head(LETTERS)

screenshot

Upvotes: 2

Related Questions