Home > Back-end >  Removing All Edges in Igraph
Removing All Edges in Igraph

Time:02-23

I have the following network graph:

library(tidyverse)
library(igraph)


set.seed(123)
n=15
data = tibble(d = paste(1:n))

relations = tibble(
  from = sample(data$d),
  to = lead(from, default=from[1]),
)

graph = graph_from_data_frame(relations, directed=T, vertices = data) 

V(graph)$color <- ifelse(data$d == relations$from[1], "red", "orange")

plot(graph, layout=layout.circle, edge.arrow.size = 0.2)

enter image description here

CodePudding user response:

If you want to create a graph without any edges, you can try the code below

make_empty_graph(15)
  • Related