Graph Generators similar to NetworkX

I am trying to create some test data including a sample social network. In NetworkX, there are several generators to create different types of graph structures. Are there any similar algorithms for neo4j?

For example:
G= nx.dorogovtsev_goltsev_mendes_graph(4,create_using=None)

Sorry for the late, like 10 months late reply. But someone just asked me this same question, which led me to this post, which for completeness is an easy one to answer. There are generators in apoc library. Or, you could just use the functions in networkx to create a list of edge node id's and build the vertices (relationships) between them in your code and fill in your own details (e.g. properties). Might also be interested in the ' A NetworkX-esque API for Neo4j Graph Algorithms' effort.

# generate ba graph
import networkx as nx
import matplotlib.pyplot as plt
%matplotlib inline
ba = nx.barabasi_albert_graph(500,7)

# Display graph and convert data into data frame
import pandas as pd

plt.axes([0.2, 0.2, 0.7, 0.7])
Gcc = sorted(nx.connected_component_subgraphs(ba), key=len, reverse=True)[0]
pos = nx.spring_layout(Gcc)
nx.draw_networkx_nodes(Gcc, pos, node_size=10)
nx.draw_networkx_edges(Gcc, pos, alpha=0.2)

# get source and target node id's

1 Like

Even better, we added a function for random graph generation about a month ago:

The new function will let you quickly create graphs, within neo4j, with a specified size and degree distribution.

Please give it a try!