Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing vertices breaks graph #74

Closed
mattwigway opened this issue Dec 2, 2023 · 2 comments
Closed

Removing vertices breaks graph #74

mattwigway opened this issue Dec 2, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mattwigway
Copy link

mattwigway commented Dec 2, 2023

After removing a vertex using rem_vertex! from Graphs.jl, the graph gets broken. Consider the following MWE below. This creates a graph that looks like this:

JFK
|   \
RDU-SFO
|   /
PHX

It then removes the RDU vertex. This breaks the graph, and accessing e.g. G[:PHX, :SFO] now results in a KeyError even though that should not have been affected by removing RDU.

using Graphs, MetaGraphsNext

G = MetaGraph(
    Graph(),
    label_type=Symbol,
    vertex_data_type=Nothing,
    edge_data_type=Float64
)

G[:RDU] = nothing
G[:JFK] = nothing
G[:SFO] = nothing
G[:PHX] = nothing

G[:RDU, :JFK] = 705.5
G[:RDU, :SFO] = 2803.3
G[:SFO, :JFK] = 2201.1
G[:SFO, :PHX] = 2311.1
G[:PHX, :RDU] = 2112.2

G[:PHX, :SFO]
#> 2311.1

rem_vertex!(G, code_for(G, :RDU))
#> true

# this should still print 2311.1, since we didn't remove PHX or SFO,
# but instead it KeyErrors
G[:PHX, :SFO]
#> ERROR: KeyError: key (:PHX, :SFO) not found

Edit to add:

  • Julia 1.9.4 aarch64
  • Graphs 1.9.0
  • MetaGraphsNext 0.6.0
@gdalle gdalle added the bug Something isn't working label Dec 4, 2023
@gdalle
Copy link
Member

gdalle commented Dec 4, 2023

I think this is the same as #69. Will test if the merged solution on master solves it. A release should come soon then

@gdalle
Copy link
Member

gdalle commented Dec 4, 2023

Yup, I confirm this will be fixed in the next release, so I'll tag it today

@gdalle gdalle closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants