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

Changes to return all optimal zero forcing sets #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

joshlag
Copy link

@joshlag joshlag commented Apr 16, 2011

The last two commits were because my editor was inserting tabs instead of 4 spaces, so I was fixing format issues because of that. I fixed my editor and I thought I got all the formating changes, however there might still be some left, sorry.

This is untested, if you would like me to test the code, I will need more time.

I did basically what we talked about, I believe you were right that we should simply send back all the optimal zero forcing sets. So first we create a flag called "found_optimal_set" and set this flag to false. I also created a dictionary of the optimal zero forcing sets, called "optimal_sets", I didn't know much about dictionaries, so I just copied the format you had on the closures dictionary and had the optimal_sets dictionary map zero forcing sets to the integers, which may allow for overflow, so we can change that to a higher allocation if necessary.

We check every time we go to a new budget number. Then we run through all the closures and what not. If we find a closure that has no unfilled vertices, then we have our optimal zero forcing set. We set the flag to true and add that zero forcing set to the "optimal_sets" dictionary, if it isn't already there.

When we check the flag on the next iteration of the budget loop, we will then create the set of optimal zero forcing sets. Once done, we free memory and return "Optimal zero forcing number", "Optimal zero forcing sets", "Number of closures we made", "Number of optimal zero forcing sets".

This of course changes what the zero_forcing_wavefront.pyx does, but I would assume you are going to save it as a different functioning function.

@joshlag
Copy link
Author

joshlag commented Apr 17, 2011

Not sure if I did this correctly, hopefully I added more to the pull request

@joshlag joshlag closed this Apr 17, 2011
@joshlag joshlag reopened this Apr 17, 2011
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