WeightedDirectedGraph

public struct WeightedDirectedGraph <Node: Hashable, Weight>:
    WeightedGraphProtocol,
    DirectedGraphProtocol
extension WeightedDirectedGraph: Equatable where Weight: Equatable
extension WeightedDirectedGraph: Hashable where Weight: Hashable

Weighted, directed graph.

Instance Properties

  • Declaration

    Swift

    public var nodes: Set<Node>
  • Declaration

    Swift

    public var weights: [Edge : Weight]

Type Aliases

  • The type of edges which connect nodes.

    Declaration

    Swift

    public typealias Edge = OrderedPair<Node>

Initializers

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

    Declaration

    Swift

    @inlinable
    public init(_ nodes: Set<Node> = [])
  • Creates a Graph with the given set of nodes and the given dictionary of weights stored by the applicable edge.

    Declaration

    Swift

    @inlinable
    public init(_ nodes: Set<Node> = [], _ weights: [Edge : Weight] = [:])
  • Creates a WeightedDirectedGraph with enough memory to store the given minimumNodesCapacity and minimumEdgesCapacity.

    Declaration

    Swift

    public init(minimumNodesCapacity: Int, minimumEdgesCapacity: Int)