Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Graph Generation Algorithms] Erdős–Rényi Graph #938

Closed
wants to merge 3 commits into from
Closed

[Graph Generation Algorithms] Erdős–Rényi Graph #938

wants to merge 3 commits into from

Conversation

MatheusFarias03
Copy link
Contributor

@MatheusFarias03 MatheusFarias03 commented May 19, 2023

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

Graph Generation Prob

Syntax:

ag_catalog.age_create_erdos_renyi_graph(graph_name name, 
                                                n int, 
                                                p name,
                                                vertex_label_name name = NULL,
                                                edge_label_name name = NULL,
                                                bidirectional bool = true)

Additionally, the probability p was set to be of type name because neither PG_GETARG_FLOAT4(2) or DatumGetFloat4(PG_GETARG_DATUM(2)); were working.

@MatheusFarias03 MatheusFarias03 closed this by deleting the head repository Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant