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
SearchDefaultsGraphprovides default types that make using these graph data structures more convenient.To conform an
IncidenceGraphtoSearchDefaultsGraph, simpliy implement the required methods. Reasonable choices for IdIndexable VertexId’s often useTablePropertyMaps. For graphs with hashable VertexId’s, theDictionaryPropertyMapis 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 moreVertexListGraphis a graph that can enumerate all the vertices within it.Declaration
Swift
public protocol VertexListGraph : GraphProtocol -
An
See moreEdgeListGraphis a graph that can enumerate all edges within it.Declaration
Swift
public protocol EdgeListGraph : GraphProtocol -
A
MutableGraphcan 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 morePropertyGraphstores additional information along with the graph structure.Declaration
Swift
public protocol PropertyGraph : GraphProtocol -
A
See moreMutablePropertyGraphkeeps track of additional metadata for each vertex and edge.Declaration
Swift
public protocol MutablePropertyGraph: MutableGraph, PropertyGraph where Vertex: DefaultInitializable, Edge: DefaultInitializable
View on GitHub
Graph Protocols & Algorithms Reference