While running some tests, I was looking for a way that can generate random nodes and edges with random values. I know in postgresql there are some helper functions like random()
and generate_series()
that can be used to fill in the table easily but what I’m looking for is a way I can create random nodes and edges between them.
Question posted in PostgreSQL
The official documentation can be found here.
The official documentation can be found here.
2
Answers
You can use the function
create_complete_graph
to generate the graph, it should look like this:In this example, 5 represents the number of nodes you want in the graph.
You can also use Python for this to generate random nodes and edges with random values. For this reason You can use utilise using Network X python library.
Official Documentation here