apache / apache/age

Barabási–Albert Graph

Open
#278 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C
Stars
4.8k
Forks
523
Avg merge
1d 2h
Merged PRs (30d)
9

Description

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](https://user-images.githubusercontent.com/7564930/188210426-e360c2b6-8107-4a12-ad68-f440757002c6.png)

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.