BasicGraph

This struct represents a graph type as a reference type.

Graphs types have a type of vertex and a direction.

The graphs are represented by adjacency lists, which have good all-around performance characteristics for sparse graphs.

Members

Functions

addEdge
void addEdge(Vertex left, Vertex right)

Add an edge to the graph.

addVertex
void addVertex(Vertex vertex)

Add a vertex to the graph.

directedEdgeCount
size_t directedEdgeCount()

Return the number of directed edges in this graph in linear time. If this graph is a graph with undirected edges, this will always be double the undirected edge count.

edgeCount
size_t edgeCount()

Return the number of edges in this graph in linear time.

hasEdge
bool hasEdge(Vertex left, Vertex right)

Check if an edge exists in the graph.

hasVertex
bool hasVertex(Vertex vertex)
removeEdge
bool removeEdge(Vertex left, Vertex right)

Remove an edge from the graph.

removeVertex
bool removeVertex(Vertex vertex)

Remove the given vertex from this graph.

Properties

vertexCount
size_t vertexCount [@property getter]

Return the number of vertices in this graph in constant time.

Variables

isDirected
enum bool isDirected;

true if this graph is a directed graph.

Meta