Skip to content

Defining a More Complex Property Graph

jbmusso edited this page Jul 11, 2016 · 6 revisions

Attention: this Wiki hosts an outdated version of the TinkerPop framework and Gremlin language documentation.


The documentation up to this point has been using examples from a simple toy graph of 6 vertices and 6 edges. For this section, a more complicated graph structure is used in the examples. A clipped representation (i.e. low weighted edges removed) of this graph is diagrammed below. This graph is a representation of the American band, the Grateful Dead.

More information about this data set can be found in the following article.

Rodriguez, M.A., Gintautas, V., Pepe, A., A Grateful Dead Analysis: The Relationship Between Concert and Listening Behavior, First Monday, volume 14, number 1, University of Illinois at Chicago Library, January 2009.

g = new TinkerGraph()
g.loadGraphML('data/graph-example-2.xml')

In the above Grateful Dead graph, there are vertices and there are edges. The vertices are broken into two sets: songs (e.g. Dark Star, China Cat Sunflower) and artists (e.g. Jerry Garcia, Robert Hunter). The following itemization describes the properties associated with vertices and edges.

  1. vertices
    • song vertices
      • type (string): always ‘song’ for song vertices.
      • name (string): the name of the song.
      • performances (integer): the number of times the song was played in concert.
      • song_type (string): whether the song is a ‘cover’ song or an ‘original’.
    • artist vertices
      • type (string): always ‘artist’ for artist vertices.
      • name (string): the name of the artist.
  2. edges
    • followed_by (song → song): if the tail song was followed by the head song in concert.
      • weight (integer): the number of times these two songs were paired in concert.
    • sung_by (song → artist): if the tail song was primarily sung by the head artist.
    • written_by (song → artist): if the tail song was written by the head artist.