You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This point of this abstract interface is to allow the partial
implementation of the `Dictionaries.jl` interface, on these graph types.
1. Adds `VertexDataGraph` and `EdgeDataGraph` as concrete subtypes of
`AbstractVertexDataGraph` and `AbstractEdgeDataGraph` respectively.
2. A new interface function `insert_vertex_data` that should be
overloaded if a given `AbstractVertexDataGraph` graph `isinsertable`.
Like wise `insert_edge_data` for `AbstractEdgeDataGraph`.
3. The three and four argument `similar_graph(::AbstractGraph, ::Type,
::Type)`, and `similar_graph(::AbstractGraph, ::Type, ::Type, vertices)`
have been removed.
A subtype of `AbstractVertexDataGraph` or `AbstractEdgeDataGraph`
implements a stricter indexing interface, inline with the one used by
`Dictionaries.jl`, that is `setindex!` strictly sets existing indices
(doesn't add a vertex/edge that isn't already in the graph). One should
use `insert!` to strictly add a new vertex/edge with data, and `set!` to
perform an `upsert` (previous behavior of `setindex!`.
Eventually, this interface will be applied to `AbstractDataGraph`, but
to avoid breaking changes this is deferred until a later date.
## New Interface
For a settable and insertable vertex data graph, one must define:
```Julia
set_vertex_data!(graph, vertex, data) # set the vertex data (assuming the vertex exists)
insert_vertex_data!(graph, vertex, data) # insert the vertex data (assuming the vertex _does not_ exist)
```
An edge data graph only needs:
```Julia
set_edge_data!(graph, edge, data) # set the edge data (assuming the required edge exists)
insert_edge_data!(graph, vertex, data) # insert the edge data (assuming the edge _does not_ exist)
```
---------
Co-authored-by: Matthew Fishman <mtfishman@users.noreply.github.com>
0 commit comments