DirectedGraph

public struct DirectedGraph<Node> : UnweightedGraphProtocol, DirectedGraphProtocol where Node : Hashable
extension DirectedGraph: Equatable
extension DirectedGraph: Hashable

Unweighted, directed graph.

Instance Properties

  • All of the nodes contained herein.

    A Node is any Hashable-conforming value.

    Declaration

    Swift

    public var nodes: Set<Node>
  • All of the edges contained herein.

    An Edge is an OrderedPair of Node values.

    Declaration

    Swift

    public var edges: Set<Edge>

Type Aliases

  • The type of edges which connect nodes.

    Declaration

    Swift

    public typealias Edge = OrderedPair<Node>

Initializers

  • Creates a DirectedGraph with the given set of nodes, with no edges between the nodes.

    Declaration

    Swift

    @inlinable
    public init(_ nodes: Set<Node> = [])
  • Creates a DirectedGraph with the given set of nodes and the given set of edges connecting the nodes.

    Declaration

    Swift

    @inlinable
    public init(_ nodes: Set<Node> = [], _ edges: Set<Edge> = [])
  • Creates a DirectedGraph which is composed a path of nodes.

    Declaration

    Swift

    @inlinable
    public init<C>(path: C) where Node == C.Element, C : Collection
  • Creates a DirectedGraph with enough memory to store the given minimumNodesCapacity and minimumEdgesCapacity.

    Declaration

    Swift

    public init(minimumNodesCapacity: Int, minimumEdgesCapacity: Int)