Q & A

This is a conversational introduction to ZGL.

What is ZGL?

1

ZGL is a graph4 definition language5 for humans7.

ZGL

How do you pronounce ZGL?

2

Like “seagull” but with a “z”.

Seagull
Seagull

Is ZGL an acronym?

3

Yes, it stands for the Z Graph Language.

What is a graph?

4

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

graph

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

What is a graph definition language?

5

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

Does ZGL support queries?

6

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

What does for humans mean?

7

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

What kind of graphs does ZGL support?

8

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

What is a z graph?

9

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.

10

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

Why “z”? What does it mean?

11

Not all questions have answers.

Fair enough.  What does directed mean?

12

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?

13

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

multigraph

What is a loop?

14

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

loop

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

15

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

Thanks.  What is a value?

16

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.

value

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

17

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?

18

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?

19

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

abstract data type

Can you give an example of an ADT?

20

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?

21

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

data structure

How do data structures compare with ADTs?

22

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

Who invented the ADT?

23

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?

24

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?

25

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?

26

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

What's next?

27
Jed Bartlet
Jed Bartlet

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

Sounds good!

28

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

Ok, what is a node?

29

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

node

What is an entity?

30

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.

entity

What is an edge?

31

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

edge

Credits

  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:
2021-03-19T22:30Z