Skip to content

Add VertexDataGraph and EdgeDataGraph#121

Merged
mtfishman merged 36 commits into
mainfrom
jd/vertex-edge-datagraph
May 28, 2026
Merged

Add VertexDataGraph and EdgeDataGraph#121
mtfishman merged 36 commits into
mainfrom
jd/vertex-edge-datagraph

Conversation

@jack-dunham
Copy link
Copy Markdown
Contributor

@jack-dunham jack-dunham commented May 15, 2026

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:

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:

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)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 82.21477% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.46%. Comparing base (69a86af) to head (e2b6986).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/abstractedgeorvertexdatagraph.jl 73.72% 36 Missing ⚠️
src/abstractdatagraph.jl 65.71% 12 Missing ⚠️
src/vertexdatagraph.jl 92.85% 4 Missing ⚠️
src/edgedatagraph.jl 98.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #121      +/-   ##
==========================================
+ Coverage   59.89%   66.46%   +6.57%     
==========================================
  Files          10       13       +3     
  Lines         566      841     +275     
==========================================
+ Hits          339      559     +220     
- Misses        227      282      +55     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/edgedatagraph.jl Outdated
Comment thread src/vertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/edgedatagraph.jl Outdated
Comment thread src/abstractdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractdatagraph.jl Outdated
Comment thread src/edgedatagraph.jl Outdated
@mtfishman
Copy link
Copy Markdown
Member

FYI something you can do to temporarily get the tests passing in this PR is to add a [sources] field to the Project.tomls that points to the branch of ITensor/NamedGraphs.jl#170 (I forget if you can just put it in Project.toml or also need it in test/Project.toml). I think that is a nice way to co-develop PRs that depend on each other.

@jack-dunham jack-dunham force-pushed the jd/vertex-edge-datagraph branch from 07854cc to 71fbb01 Compare May 27, 2026 20:10
@jack-dunham jack-dunham force-pushed the jd/vertex-edge-datagraph branch from d1089dd to b91cd71 Compare May 27, 2026 20:22
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
Comment thread src/abstractedgeorvertexdatagraph.jl Outdated
jack-dunham and others added 5 commits May 28, 2026 16:23
A generic version now exists in `NamedGraphs.GraphsExtensions`
Removed NamedGraphs source dependency from Project.toml.
Removed NamedGraphs source dependency from Project.toml
@mtfishman mtfishman closed this May 28, 2026
@mtfishman mtfishman reopened this May 28, 2026
@mtfishman mtfishman closed this May 28, 2026
@mtfishman mtfishman reopened this May 28, 2026
@mtfishman mtfishman enabled auto-merge (squash) May 28, 2026 21:45
@mtfishman mtfishman changed the title Add VertexDataGraph and EdgeDataGraph as concrete subtypes of AbstractVertexOrEdgeDataGraph Add VertexDataGraph and EdgeDataGraph May 28, 2026
@mtfishman mtfishman disabled auto-merge May 28, 2026 21:46
@mtfishman mtfishman enabled auto-merge (squash) May 28, 2026 21:46
@mtfishman mtfishman merged commit a569797 into main May 28, 2026
20 checks passed
@mtfishman mtfishman deleted the jd/vertex-edge-datagraph branch May 28, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants