WeightedGraphProtocol
public protocol WeightedGraphProtocol : GraphProtocol
Interface for weighted graphs.
-
The type of the weight of an
Edge.Declaration
Swift
associatedtype Weight
-
The storage of weights by the applicable edge.
Declaration
Swift
var weights: [Edge : Weight] { get set }
-
unweighted()Extension methodDeclaration
Swift
@inlinable public func unweighted<U>() -> U where U : UnweightedGraphProtocol, Self.Edge == U.EdgeReturn Value
An unweighted version of this
WeightedGraphProtocol-conforming type value.
-
edgesExtension methodDeclaration
Swift
@inlinable public var edges: Set<Edge> { get }Return Value
All of the edges contained herein.
-
weight(from:Extension methodto: ) Declaration
Swift
@inlinable public func weight(from source: Node, to destination: Node) -> Weight?Return Value
The weight for the edge connecting the given
sourceanddestinationnodes, if the givenedgeis contained herein. Otherwise,nil. -
weight(_:Extension method) Declaration
Swift
@inlinable public func weight(_ edge: Edge) -> Weight?Return Value
The weight for the given
edge, if the givenedgeis contained herein. Otherwise,nil.
-
insertEdge(from:Extension methodto: weight: ) Inserts an edge between the given
sourceanddestinationnodes, with the givenweight.If the
sourceordestinationnodes are not yet contained herein, they are inserted.Declaration
Swift
@inlinable public mutating func insertEdge(from source: Node, to destination: Node, weight: Weight) -
remove(_:Extension method) Remove
edgefrom graph.Declaration
Swift
@inlinable public mutating func remove(_ edge: Edge) -
insertEdge(_:Extension methodweight: ) Inserts the given
edgewith the givenweight.Declaration
Swift
@inlinable public mutating func insertEdge(_ edge: Edge, weight: Weight) -
updateEdge(from:Extension methodto: by: ) -
updateEdge(_:Extension methodby: )
View on GitHub
Install in Dash
WeightedGraphProtocol Protocol Reference