Graph Syntax

Graphs use both key and slice notation to refer to nodes and edges, respectively. This works for both assignment and lookup of the respective value.

Nodes

A node is written directly. Its value is the adjacency associated with the node in the graph, i.e. a mapping to all neighbours and the respective edge value.

\mathtt{
    \underbrace{\vphantom{\bigl[}\mathtt{flighttime}}_\mathtt{graph}
        [\underbrace{\vphantom{\bigl[}\mathtt{Berlin}}_\mathtt{node}]
        =
        \overbrace{
          \{
            \underbrace{\vphantom{\bigl[}\mathtt{London}}_\mathtt{node}
            :
            \underbrace{\vphantom{\bigl[}\mathtt{3900}}_\mathtt{value}
            , ...
          \}
        }^\mathtt{adjacency}
}

Edges

An edge is written using slice notation. Its value is the edge value associated with the edge in the graph.

\mathtt{
    \underbrace{\vphantom{\bigl[}\mathtt{flighttime}}_\mathtt{graph}
        [\overbrace{
            \underbrace{\vphantom{\bigl[}\mathtt{Berlin}}_\mathtt{node}
            :
            \underbrace{\vphantom{\bigl[}\mathtt{London}}_\mathtt{node}
        }^{edge}] = \underbrace{\vphantom{\bigl[}\mathtt{3900}}_\mathtt{value}
}