Generating Graphs

Generate undirected (random direction) graphs with semi-real random distributions based on theoretical models. Providing a node label will generate nodes with that label and a random uuid property. Providing a relationship type will generate relationships with that type. Providing null in place of labels and/or relationships will generate random Person nodes with a random name and FRIEND_OF relationships, respectively.

For a theoretical introduction, please take a look at the following blog posts:

For permitted configuration values, please look at the Javadoc of config classes of the respective generators (BarabasiAlbertConfig, ErdosRenyiConfig, WattsStrogatzConfig, and DistributionBasedConfig).

Apart from the number of nodes you would like to generate, null can be passed in for all other parameters. Sensible defaults will be used.

type qualified name signature description

procedure

apoc.generate.ba

apoc.generate.ba(noNodes :: INTEGER?, edgesPerNode :: INTEGER?, label :: STRING?, type :: STRING?) :: VOID

apoc.generate.ba(noNodes, edgesPerNode, label, type) - generates a random graph according to the Barabasi-Albert model

procedure

apoc.generate.complete

apoc.generate.complete(noNodes :: INTEGER?, label :: STRING?, type :: STRING?) :: VOID

apoc.generate.complete(noNodes, label, type) - generates a random complete graph

procedure

apoc.generate.er

apoc.generate.er(noNodes :: INTEGER?, noEdges :: INTEGER?, label :: STRING?, type :: STRING?) :: VOID

apoc.generate.er(noNodes, noEdges, label, type) - generates a random graph according to the Erdos-Renyi model

procedure

apoc.generate.simple

apoc.generate.simple(degrees :: LIST? OF INTEGER?, label :: STRING?, type :: STRING?) :: VOID

apoc.generate.simple(degrees, label, type) - generates a simple random graph according to the given degree distribution

procedure

apoc.generate.ws

apoc.generate.ws(noNodes :: INTEGER?, degree :: INTEGER?, beta :: FLOAT?, label :: STRING?, type :: STRING?) :: VOID

apoc.generate.ws(noNodes, degree, beta, label, type) - generates a random graph according to the Watts-Strogatz model

Example

CALL apoc.generate.ba(1000, 2, 'TestLabel', 'TEST_REL_TYPE')
CALL apoc.generate.ws(1000, null, null, null)
CALL apoc.generate.simple([2,2,2,2], null, null)