Q & A

This is a conversational introduction to ZGL.

What is ZGL?


ZGL is a graph4 definition language5 for humans7.


How do you pronounce ZGL?


Like “seagull” but with a “z”.


Is ZGL an acronym?


Yes, it stands for the Z Graph Language.

What is a graph?


A graph is a collection of nodes29 and edges31.  Edges connect nodes.


For example, here is a graph with 4 nodes and 3 edges:

What is a graph definition language?


A language that defines graphs, as opposed to querying7 them.

Does ZGL support queries?


Not at this time, but it may in the future.

What does for humans mean?


It means ZGL is convenient for humans to read and write.

What kind of graphs does ZGL support?


ZGL supports z graphs9, which generalize many kinds of graphs.

What is a z graph?


A z graph is a directed12 multigraph13 where loops14 are permitted and any value16 may be used as a node29 or edge31.

z graph

This is the first I've heard of a z graph.


Right, it is a new term.  I made it up.

Why “z”? What does it mean?


Not all questions have answers.

Fair enough.  What does directed mean?


In a directed graph, each edge31 has a direction.  Think of an edge as an arrow from a source node29 to a target node.

directed graph

Ok, what is a multigraph?


As used here, a multigraph is a graph4 where multiple edges31 between two nodes are permitted but not required.


What is a loop?


A loop is an edge31 that connects a node29 to itself.


Remind me of the last part of the z graph9 definition?


Sure.  We haven't discussed this part: “... and any value16 may be used as a node29 or edge31”.

Thanks.  What is a value?


In ZGL, a value is an instance of one of the following abstract data types17 (ADTs): boolean, integer, float, string, URL, quantity, date, datetime, entity30, list, map, set, and z graph9.


Would you give advance warning if you were planning to give an hour-long talk about ADTs?


I don't have such a talk prepared.  But if I did, I'd be happy to invite you.  Thanks for asking!

That's not exactly what I mean.  If I understand ADTs, perhaps I can skip ahead?


Sure, if so, feel free to jump ahead to Why does ZGL use ADTs instead of data structures?24.

What is an abstract data type?


An abstract data type (ADT) defines the interface for a data structure20.

abstract data type

Can you give an example of an ADT?


Sure.  For example, let's define a Map ADT, which provides a mapping between keys and values.  It has these operations:

  • new : create a new Map
  • clone : make a copy of an existing Map
  • get : lookup a key and return its value, if present
  • insert : insert a (key, value) pair

These operations define the ADT's interface.  Because it is an ADT, Map does not specify a concrete representation, such as a memory layout.

What is a data structure?


A data structure is a particular way of organizing data for particular types of operations.

data structure

How do data structures compare with ADTs?


A data structure20 chooses a concrete representation to implement an abstract data type17.

Who invented the ADT?


Barbara Liskov and Stephen Zilles proposed ADTs17 in 1974 in Programming with Abstract Data Types.

Barbara Liskov
Barbara Liskov

Can you give more ADT examples?


Here is a table with three ADTs17 and some corresponding data structures20.

ADT data structures
list array, linked list
map association list, B-tree, hash table
graph adjacency list, adjacency matrix, incidence matrix

Why does ZGL use ADTs instead of data structures?


ZGL uses ADTs17 because they are more general than data structures20.  This simplifies interactions with different languages and databases, which are free to represent the ADTs as they wish.

But what if I want to specify a data structure?


Interesting; I'd like to hear more about your use case(s).  Let's move the discussion to the ZGL forum.

What's next?

Jed Bartlet
Jed Bartlet

How about we continue on the thread of "any value16 may be used as a node29 or edge31"?

Sounds good!


Only a little bit more to go to unpack the z graph9 definition!

Ok, what is a node?


In ZGL, a node is a component of a z graph9.  Any value16 may be used as a node.


What is an entity?


In ZGL, each entity name is aliased to an (unknown) entity id.  The entity id cannot be used directly. 

For example, x and /person/Romain_Collin are entity names.  Note: it is convenient to say entity to mean entity name.


What is an edge?


In ZGL, an edge connects a source node and a target node.  Like nodes, any value16 may be used as an edge.



  1. Seagull at the Pointe du Raz, Finistere, Britanny, France, August 2007 by Patrick C is licensed under CC BY-SA 2.0.
  2. Barbara Liskov, computer scientist, 2010 by Kenneth C. Zirkel is licensed under CC BY-SA 3.0.
  3. Illustration of Jed Bartlet from The West Wing by Jason Rodriguez is used with permission.
Last update: