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

Recovery simulations #23

Merged
merged 6 commits into from
Oct 3, 2023
Merged

Recovery simulations #23

merged 6 commits into from
Oct 3, 2023

Conversation

annehaley
Copy link
Collaborator

@annehaley annehaley commented Sep 21, 2023

This PR adds a new Simulation type, "Recovery Scenario". For its input arguments, the user can select the following:

  • an existing SimulationResult object from a node failure simulation
  • a recovery mode from a list of strings: random, betweenness, degree, information, eigenvector, load, closeness, second order

image

The implementation of this simulation utilizes a function written by Jack Watson at NEU, shared with us for this simulation. The options available in that function determine the list of available recovery modes.

The animation of the results of this simulation only required a slight modification to the NodeFailureAnimation component, now renamed NodeAnimation. The component now accepts a list of node_recoveries alongside the list of node_failures. If node_recoveries is specified, the animation will subtract the current slice of recovered nodes from the list of failed nodes.

image

@annehaley annehaley changed the base branch from master to simulations-pane September 21, 2023 17:12
@annehaley annehaley mentioned this pull request Sep 21, 2023
Base automatically changed from simulations-pane to master September 21, 2023 17:55
@annehaley annehaley requested a review from jjnesbitt September 21, 2023 18:04
@jjnesbitt
Copy link
Member

@annehaley I pushed 476273f, I hope you don't mind. I noticed that in construct_edge_list, node.adjacent_nodes was being called once per node, causing a SQL query to be made for every node in the graph. Since the amount of nodes we currently have is only in the hundreds, and we only run this app locally, those n sql queries don't have a humongous impact. However, if either of those two situations were to change, that function would become very slow indeed. I updated that function to instead make 2 SQL queries, which seems to perform much better, and should be able to handle much larger graphs.

I believe I tested it enough to show it has feature parity with the existing implementation, but please give it a try to make sure I'm not missing anything, and/or otherwise lmk what you think.

@annehaley
Copy link
Collaborator Author

annehaley commented Oct 3, 2023

@AlmightyYakob I tried out 476273f and it works well. Thank you for optimizing that.

Suggested by @AlmightyYakob

Co-authored-by: Jacob Nesbitt <jjnesbitt2@gmail.com>
@annehaley annehaley merged commit 7f798ac into master Oct 3, 2023
@annehaley annehaley deleted the recovery-sim branch October 3, 2023 17:34
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