MutablePropertyGraph
public protocol MutablePropertyGraph: MutableGraph, PropertyGraph
where Vertex: DefaultInitializable, Edge: DefaultInitializable
A MutablePropertyGraph
keeps track of additional metadata for each vertex and edge.
-
Adds a vertex to the graph.
Declaration
Swift
mutating func addVertex(storing vertexProperty: Vertex) -> VertexId
-
Adds an edge to the graph.
Declaration
Swift
mutating func addEdge(from source: VertexId, to destination: VertexId, storing edgeProperty: Edge) -> EdgeId
-
addVertex()
Extension methodAdds a new vertex to the graph, with a default initialized
Vertex
.Declaration
Swift
public mutating func addVertex() -> VertexId
-
addEdge(from:
Extension methodto: ) Adds an edge from
source
todestination
with a default initializedEdge
.Declaration
Swift
public mutating func addEdge(from source: VertexId, to destination: VertexId) -> EdgeId
-
init(_:
Extension methodvertexMapping: vertexProperties: edgeProperties: ) Initializes
self
as a copy of the incidences ofother
and storing the properties ofvertexProperties
andedgeProperties
.Declaration
Swift
public init< Other: IncidenceGraph & VertexListGraph, VertexMapping: ExternalPropertyMap, VertexProperties: PropertyMap, EdgeProperties: PropertyMap >( _ other: Other, vertexMapping: inout VertexMapping, vertexProperties: VertexProperties, edgeProperties: EdgeProperties ) where VertexMapping.Graph == Other, VertexMapping.Key == Other.VertexId, VertexMapping.Value == VertexId, VertexProperties.Graph == Other, VertexProperties.Key == Other.VertexId, VertexProperties.Value == Vertex, EdgeProperties.Graph == Other, EdgeProperties.Key == Other.EdgeId, EdgeProperties.Value == Edge
-
init(_:
Extension methodvertexMapping: ) Initializes
self
as a copy of the incidences and properties ofother
.Complexity
O(|V| + |E|)Declaration
Swift
public init< Other: IncidenceGraph & VertexListGraph & PropertyGraph, VertexMapping: ExternalPropertyMap >(_ other: Other, vertexMapping: inout VertexMapping) where VertexMapping.Graph == Other, VertexMapping.Key == Other.VertexId, VertexMapping.Value == VertexId, Other.Vertex == Vertex, Other.Edge == Edge
-
init(_:
Extension method) Initializes
self
as a copy of the incidences and properties ofother
.Complexity
O(|V| + |E|)Declaration
Swift
public init< Other: IncidenceGraph & VertexListGraph & PropertyGraph & SearchDefaultsGraph >(_ other: Other) where Other.VertexId == VertexId, Other.Vertex == Vertex, Other.Edge == Edge