UnweightedGraphProtocol

public protocol UnweightedGraphProtocol : GraphProtocol

Interface for unweighted graphs.

Instance Properties

  • All of the edges contained herein.

    Declaration

    Swift

    var edges: Set<Edge> { get set }

Initializers

  • Creates an UnweightedGraphProtocol-conforming type value with the given set of nodes and the given set of edges.

    Declaration

    Swift

    init(_ nodes: Set<Node>, _ edges: Set<Edge>)
  • init(path:) Extension method

    Creates an UnweightedGraphProtocol-conforming type value which is composed a path of nodes.

    Declaration

    Swift

    @inlinable
    public init<S>(path: S) where S : Sequence, Self.Node == S.Element

Modifying

  • insertEdge(from:to:) Extension method

    Inserts an edge between the given source and destination nodes.

    If the source or destination nodes are not yet contained herein, they are inserted.

    Declaration

    Swift

    @inlinable
    public mutating func insertEdge(from source: Node, to destination: Node)
  • remove(_:) Extension method

    Removes edge from graph.

    Declaration

    Swift

    @inlinable
    public mutating func remove(_ edge: Edge)
  • +(_:_:) Extension method

    Declaration

    Swift

    @inlinable
    public static func + (lhs: Self, rhs: Self) -> Self

    Return Value

    A new graph with the union of the nodes and edges of the two given graphs.