Getting started with gremlin – Using the Toy Graphs

The TinkerPop "toy graphs" make it possible to quickly try out some basic features of Gremlin. These graphs are pre-built and packaged with the Gremlin Console. The most commonly used "toy graphs" are "Modern" and "The Crew". When asking questions on StackOverflow or the Gremlin Users mailing list it is often useful to frame questions in the context of these graphs as they can help questions get answered quickly and easily by the community.

Both the Modern and Crew graph can be constructed with the TinekrFactory, which will construct an in-memory TinkerGraph with the data pre-loaded:

gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V()
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]

Note the conventions in the above code. The Graph instance is typically called "graph" and then to execute traversals (i.e. queries) one creates a TraversalSource from that Graph called "g". Then, the query g.V() executes a traversal that gets a list of all the vertices in "g".

To create "The Crew" graph, which features meta/multi-properties, use TinkerFactory.createTheCrew().

More information about using the toy graphs can be found in TinkerPop’s tutorial called The Gremlin Console.

if you want to reproduce, please indicate the source:
Getting started with gremlin – Using the Toy Graphs - CodeDay