To make it possible to iterate over all points that share an edge with a given vertex, we have a Graph struct that we define as follows:

struct Graph{I}
    function Graph{I}() where {I}
        G = UndirectedGraph{I}()
        return new{I}(G)
    Graph() = Graph{Int}()
    Graph(G::UndirectedGraph{I}) where {I} = new{I}(G)

Note that this graph is undirected.


Struct for storing neighbourhood relationships that map vertices to all other vertices that share an edge with that vertex. The type I is the integer type.

See the docs for a description of how boundary edges are handled.


  • graph::UndirectedGraph{I}

The UndirectedGraph that maps a vertex u to a list of edges, V, such that (u, v) is an edge of the triangulation for each v in V.

Extended help

You should not work with the graph field directly. We provide the following functions for working with Graph, where G denotes a Graph{I} type. (Type information in the function signatures is omitted.)


  • get_graph(G)
  • get_vertices(G)
  • each_vertex(G)
  • get_edges(G)
  • get_neighbours(G)
  • get_neighbours(G, u)


  • add_vertex!(G, u...)
  • add_neighbour!(G, u, v...)
  • add_triangle!(G, i, j, k) or add_triangle!(G, T)
  • add_triangle!(G, T...)
  • delete_triangle!(G, i, j, k) or delete_triangle!(G, T)
  • delete_triangle!(G, T...)
  • delete_neighbour!(G, u, v...)
  • delete_vertex!(G, u...)
  • delete_boundary_vertices_from_graph!(G)
  • clear_empty_points!(G)


  • num_edges(G)
  • num_neighbours(G, u)
  • num_vertices(G)
  • has_vertex(G, u)
  • has_boundary_vertices(G)
add_triangle!(G::Graph, i, j, k)

Given a graph G, adds the triangle (i, j, k) into G. In particular, the indices (i, j, k) are added into G, and the indices are all in each other's neighbourhoods.

delete_triangle!(G::Graph, i, j, k)

Given a graph G, deletes the triangle (i, j, k) deletes G. In particular, the indices (i, j, k) will no longer be neighbours of each other.


Be careful with using this function - you could have a triangle (j, i, ℓ), say, which will also be affected since the graph is undirected. Note also that the vertices (i, j, k) will not be removed - only the neighbourhoods are affected.