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

Starting to fix #37 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Starting to fix #37 #40

wants to merge 1 commit into from

Conversation

gdalle
Copy link

@gdalle gdalle commented May 9, 2021

Hi there 👋
I tried to code a first version of rem_vertex! by drawing inspiration from the one in LightGraphs.jl. It only works on ValGraph for now, because I wanted to discuss the implementation.
I didn't add tests because they seem to be broken for this part of the codebase (which is probably why this line is commented?).
Anyway, let me now what you think!

@simonschoelly
Copy link
Owner

Hi, I did not have time yet to look to much into this PR, but it is highly appreciated. Will try to do that this week. The tests are a bit of a mess indeed, I will check where they would go best.
You are right, that we should definitely model this after LightGraphs, so that there are no surprises.

for s in neigs_v
rem_edge!(g, s, v)
end
values_selfloop = nothing # TODO: fix this type instability
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not worry too much about type instability. If you have some variable of type Union{T, Nothing} for some type T, then Julia will still be able to create efficient code. In general, Julia can generate efficient code, as long as there are not too many types involved in an Union. That's why using @code_warntype will also color this variable yellow and not red.

# remove the in_edges incident to v
neigs_v = copy(inneighbors(g, v))
for s in neigs_v
rem_edge!(g, s, v)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it were not better, if we would work directly with the adjacency lists here - after all this method does not have to solve the abstract case, but only has to work for this graph.

@simonschoelly
Copy link
Owner

So I would suggest you add tests to interface/modifiers.jl - the tests for rem_edge! are already there. Eventually I will clean this up and just move these tests then somewhere else.

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