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 method

    Adds a new vertex to the graph, with a default initialized Vertex.

    Declaration

    Swift

    public mutating func addVertex() -> VertexId
  • addEdge(from:to:) Extension method

    Adds an edge from source to destination with a default initialized Edge.

    Declaration

    Swift

    public mutating func addEdge(from source: VertexId, to destination: VertexId) -> EdgeId

Available where Self: DefaultInitializable

  • Initializes self as a copy of the incidences of other and storing the properties of vertexProperties and edgeProperties.

    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(_:vertexMapping:) Extension method

    Initializes self as a copy of the incidences and properties of other.

    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 of other.

    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