View source: R/Dijkstra_graphGenerator.R
generate_random_graph | R Documentation |
This function generates a random weighted graph with 'n' vertices and 'm' edges, where 'm' is determined based on the probability 'p' of an edge existing between any two vertices.
generate_random_graph(n, p)
n |
Integer. The number of vertices in the graph. |
p |
Numeric. The probability of an edge existing between two vertices. |
A data frame with three columns:
"v1": The first vertex of the edge.
"v2": The second vertex of the edge.
"cost": A random weight assigned to the edge (sampled from a normal distribution).
generate_random_graph(10, 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.