Mogwai logo

Mogwai

A concise text format for describing graphs

Mogwai represents graphs using a line based syntax. Each line is either a node or an edge. Comments start with #.

Nodes

Nodes are defined with an identifier and a label. Optional properties can follow in parentheses.

alice:Person
book:Book(title="1984", year=1949)

Edges

Edges connect two nodes with a relationship label. Use one dash for solid lines or two dashes for dotted lines.

alice-friends->bob
alice--seen-->movie(rating=5)

The general pattern is <from>-<rel>-><to>. Use -- on both sides of the relation to create a dotted edge.

Comments

Add comments anywhere on a line after #. The parser ignores everything after the hash.

# define two people
alice:Person # first person
bob:Person

Complete example

alice:Person(name="Alice")
bob:Person(name="Bob")
movie:Movie(title="Inception")
alice-friends->bob
alice--watched-->movie(date="2010-07-16")

Try it out

Experiment with Mogwai in the interactive editor.