Graph Protocols & Algorithms
-
Represents a Graph data structure.
This is modeled off of the Boost Graph Library; see https://www.boost.org/doc/libs/1_72_0/libs/graph/doc/Graph.html.
See moreDeclaration
Swift
public protocol GraphProtocol
-
A graph that allows retrieval of edges from each vertex.
See moreDeclaration
Swift
public protocol IncidenceGraph : GraphProtocol
-
A graph that provides defaults for graph searching algorithms.
Implementations of Graph algorithms often demand a variety of associated data structures. A graph that conforms to
SearchDefaultsGraph
provides default types that make using these graph data structures more convenient.To conform an
IncidenceGraph
toSearchDefaultsGraph
, simpliy implement the required methods. Reasonable choices for IdIndexable VertexId’s often useTablePropertyMap
s. For graphs with hashable VertexId’s, theDictionaryPropertyMap
is often a good choice.Note: we have to spell out each of these associated PropertyMaps explicitly, because associated types cannot be generic in Swift, and we want to avoid existentials.
See moreDeclaration
Swift
public protocol SearchDefaultsGraph : IncidenceGraph
-
A graph that allows retrieval of edges incoming to each vertex (the “in-edges”).
See moreDeclaration
Swift
public protocol BidirectionalGraph : IncidenceGraph
-
A
See moreVertexListGraph
is a graph that can enumerate all the vertices within it.Declaration
Swift
public protocol VertexListGraph : GraphProtocol
-
An
See moreEdgeListGraph
is a graph that can enumerate all edges within it.Declaration
Swift
public protocol EdgeListGraph : GraphProtocol
-
A
MutableGraph
can be changed via the addition and removal of edges and vertices.In the documentation of complexity guarantees, |V| is the number of nodes, and |E| is the number of edges.
See moreDeclaration
Swift
public protocol MutableGraph : GraphProtocol
-
A
See morePropertyGraph
stores additional information along with the graph structure.Declaration
Swift
public protocol PropertyGraph : GraphProtocol
-
A
See moreMutablePropertyGraph
keeps track of additional metadata for each vertex and edge.Declaration
Swift
public protocol MutablePropertyGraph: MutableGraph, PropertyGraph where Vertex: DefaultInitializable, Edge: DefaultInitializable