-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Approximate minimum feedback vertex set #2316
base: main
Are you sure you want to change the base?
Conversation
cc @JamesClough |
# weights of all nodes. | ||
except StopIteration: | ||
gamma = min(weights[v] / (d - 1) for v, d in G.degree()) | ||
weights -= {v: gamma * (d - 1) for v, d in G.degree()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried running this to see what the problem was - my problem (running Python 2.7 - don't know if this is different in other versions) was this line where we're trying to subtract a dictionary from a Counter. Was this dictionary meant to be a Counter as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually works on Python 3, but not on Python 2 it seems.
# approximation guarantee. | ||
while stack: | ||
v = stack.pop() | ||
if nx.is_forest(G_original.subgraph(F - {v})): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we're checking whether the FVS minus vertex v is a forest - but shouldn't we actually be checking whether the original graph minus (FVS - v) is a forest?
@JamesClough You are correct in both of your comments, I'll make those changes and try again. |
3cf7448
to
5e47f1f
Compare
Improved implementation of pull request #2279; fixes issue #2270.
Currently does not work but I'm not sure why. It's kind of a pain to debug. Hopefully someone can figure it out.