SearchDefaultsGraph
public protocol SearchDefaultsGraph : IncidenceGraph
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
to SearchDefaultsGraph
, simpliy implement the required methods.
Reasonable choices for IdIndexable VertexId’s often use TablePropertyMap
s. For graphs with
hashable VertexId’s, the DictionaryPropertyMap
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.
-
A reasonable choice for a data structure to use when keeping track of visitation state during graph searches and traversals.
Declaration
Swift
associatedtype DefaultColorMap: ExternalPropertyMap where DefaultColorMap.Graph == Self, DefaultColorMap.Key == VertexId, DefaultColorMap.Value == VertexColor
-
Creates an instance of the default color map where every vertex is set to
color
.Declaration
Swift
func makeDefaultColorMap(repeating color: VertexColor) -> DefaultColorMap
-
A reasonable choice for a data structure to use when mapping vertices to an arbitrary integer.
Declaration
Swift
associatedtype DefaultVertexIntMap: ExternalPropertyMap where DefaultVertexIntMap.Graph == Self, DefaultVertexIntMap.Key == VertexId, DefaultVertexIntMap.Value == Int
-
Creates an instance of the default vertex integer map.
Declaration
Swift
func makeDefaultVertexIntMap(repeating value: Int) -> DefaultVertexIntMap
-
A reasonable choice for a data structure to use when mapping vertices to other vertices.
Declaration
Swift
associatedtype DefaultVertexVertexMap: ExternalPropertyMap where DefaultVertexVertexMap.Graph == Self, DefaultVertexVertexMap.Key == VertexId, DefaultVertexVertexMap.Value == VertexId
-
Creates an instance of the default vertex vertex map.
Declaration
Swift
func makeDefaultVertexVertexMap(repeating value: VertexId) -> DefaultVertexVertexMap