# NOT RUN {
## Random undirected graph with 3 nodes and 50% density of edges
rgraph(p = 3, d = 0.5)
## Random directed acyclic graphs
# Following the natural ancestral order 1, ..., p
dag <- rgraph(p = 6, d = 0.5, dag = TRUE)
igraph::topo_sort(dag)
# Following a random ancestral order
dag <- rgraph(p = 6, d = 0.5, dag = TRUE, ordered = FALSE)
igraph::topo_sort(dag)
# }
Run the code above in your browser using DataLab