Se importan las librerias necesarias
library("igraph")
## Warning: package 'igraph' was built under R version 4.1.3
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
library("dplyr")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:igraph':
##
## as_data_frame, groups, union
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Se crea un grafo llamado g utilizando la función make_graph, especificando los bordes y el número total de nodos.
g <- make_graph(edges = c(1,2, 1,5), n=10, directed = FALSE)
plot.igraph(g,
edge.curved = FALSE,
edge.color = "red",
edge.width = 0.3,
edge.arrow.size = 0.3,
vertex.color = "blue",
vertex.size = 10)