简体   繁体   中英

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")    

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)

截屏

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM