age icon indicating copy to clipboard operation
age copied to clipboard

Barabási–Albert Graph

Open JoshInnis opened this issue 3 years ago • 1 comments

Returns a random graph using Barabási–Albert preferential attachment

A graph of nodes is grown by attaching new nodes each with edges that are preferentially attached to existing nodes with high degree.

Description: The network begins with an initial connected network of m_0 nodes.

New nodes are added to the network one at a time. Each new node is connected to m <= m_0 existing nodes with a probability that is proportional to the number of links that the existing nodes already have. Formally, the probability p_i that the new node is connected to node i is

Image

where k_i is the degree of node i and the sum is made over all pre-existing nodes j (i.e. the denominator results in twice the current number of edges in the network). Heavily linked nodes ("hubs") tend to quickly accumulate even more links, while nodes with only a few links are unlikely to be chosen as the destination for a new link. The new nodes have a "preference" to attach themselves to the already heavily linked nodes.

Syntax:

ag_catalog.age_create_barabasi_albert_graph(graph_name Name, n int, int m, p float
                                    vertex_label_name Name DEFAULT = NULL,
                                    vertex_properties agtype DEFAULT = NULL,
                                    edge_label_name Name DEAULT = NULL,
                                    edge_properties agtype DEFAULT = NULL,
                                    bidirectional bool DEFAULT = true)

Input:

  • graph_name - Name of the graph to be created
  • n - The number of nodes
  • m - Number of edges to attach from a new node to existing nodes
  • p -The probability of each edge existing
  • vertex_label_name - Name of the label to assign each vertex to.
  • vertex_properties - Property values to assign each vertex. Default is NULL
  • edge_label_name - Name of the label to assign each edge to.
  • edge_properties - Property values to assign each edge. Default is NULL
  • bidirectional - Bidirectional True or False. Default True.

JoshInnis avatar Sep 06 '22 23:09 JoshInnis

Would be happy to contribute for this one!

MatheusFarias03 avatar Apr 26 '23 21:04 MatheusFarias03