O'Reilly logo

Learning Neo4j 3.x - Second Edition by Rik Van Bruggen, Jérôme Baton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Random graph generators

Well, not so random  graph generators, for there is an algorithm to choose and parameters to input. I call it random because it's meaningless:

CALL apoc.generate.ba(1000, 2, 'Person', 'FRIEND_OF')

This example uses the Barabasi-Albert (ba) model to generate a thousand nodes with the label Person that have two FRIEND_OF relations. As Person is a common label, each node will have a name property, which looks as follows, added automatically:

A lot of friends, connected

Be aware that this can create the relation from a node to itself, which is rather funny with example. So to find all the People who are friends of themselves, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required