StronglyConnectedComponents
public struct StronglyConnectedComponents<Vertex> where Vertex : Hashable
extension StronglyConnectedComponents: Sendable where Vertex: Sendable
The strongly connected components of a directed graph.
-
A map from vertex identifier to its properties.
Declaration
Swift
private var properties: [Vertex : Properties] -
A map from component to its vertices.
Declaration
Swift
private var components: [[Vertex]] -
The stack of vertices being visited.
Declaration
Swift
private var stack: [Vertex] -
The next vertex index.
Declaration
Swift
private var nextIndex: Int -
Creates an empty instance.
Declaration
Swift
public init() -
Returns the vertices in the given component.
Declaration
Swift
public func vertices(in c: Int) -> [Vertex] -
Returns the strongly connected component containing
v, callingenumerateSuccessorsto obtain the successors of a vertex.Declaration
Swift
public mutating func component( containing v: Vertex, enumeratingSuccessorsWith enumerateSuccessors: (Vertex) -> [Vertex] ) -> Int -
The properties associated with a vertex in Tarjan’s algorithm.
See moreDeclaration
Swift
private struct Properties : Sendable
View on GitHub