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

Approximate minimum feedback vertex set #2316

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

Conversation

jfinkels
Copy link
Contributor

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.

@jfinkels
Copy link
Contributor Author

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()}
Copy link
Contributor

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?

Copy link
Contributor Author

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})):
Copy link
Contributor

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?

@jfinkels
Copy link
Contributor Author

@JamesClough You are correct in both of your comments, I'll make those changes and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants