[Graph Generation Algorithms] Erdős–Rényi Graph #938
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is related to #277 and adds a new function
age_create_erdos_renyi_graph
that generates a random graph with n nodes, where the probability for each node to connect to another one is based on a given probability. The edges can be set to be in one direction or in both directions. It is also possible to set the labels for both vertices and edges.It uses the G(n,p) model, where the graph is constructed by connecting labeled nodes randomly. Each edge is included in the graph with probability p, independently from every other edge. Equivalently, the probability for generating each graph that has n nodes and M edges is
Syntax:
Additionally, the probability
p
was set to be of typename
because neitherPG_GETARG_FLOAT4(2)
orDatumGetFloat4(PG_GETARG_DATUM(2));
were working.