TheoryInPractice / CONCUSS

Combatting Network Complexity Using Structural Sparsity
Other
8 stars 5 forks source link

Updating Data Structures (Dictionaries -> Lists) #8

Closed brandon-mork closed 9 years ago

brandon-mork commented 9 years ago

Summary of Changes: Converted instances of dictionaries that used keys 0 through len( dict ) - 1 to lists, matching indices to previous key values. Lists provide faster lookups than dicts, which motivated this change where possible. Lists that are too short to add at desired index get extended before adding at that index

Specific dictionaries changed detailed below:

  1. lib/coloring/basic * low_degree_orientation.py: degdist [became deglist]; buckets [defaultdict(set) to list of sets] * sandpile_orientation.py: degdict [became deglist]; buckets [defaultdict(set) to list of sets] * truncated_tf_augmentation.py: indegs
  2. lib/coloring/coloring * max_deg.py: degdict [became deglist]; [did not convert buckets, due to entry deletion] * min_deg.py: degdict [became deglist]; [did not convert buckets, due to entry deletion]
  3. lib/graph/ * graph.py: self.adj [defaultdict( set ) to list of sets; added checks to ensure set was present in list before attempting to discard contents from it]; remove_loops: res [defaultdict( int ) to list]; calc_degeneracy: buckets [defaultdict( set ) to list of sets]; calc_degeneracy: degdict -> deglist * graph_formats.py: indices * td_decomposition.py: self.vertex_records
  4. lib/decomposition * dfs_sweep.py: comps
  5. lib/pattern_counting/dp * bv_kpattern.py: self.vertex_records
bdsullivan commented 9 years ago

Brandon - can you cancel & try this again with a "Summary of Additions" block for improved identification of what's going on? The current label on the pull request is not informative -- "Merging with Master" should really be "Replacing Dictionary data structures with lists where possible" or something. I'd love to see a quick itemized list of what dictionaries got replaced (variable names & file/method location, perhaps?) in case I need to track down issues in the future. Take a look at Nishant's request for an example. Thanks!

brandon-mork commented 9 years ago

Is this edit sufficient?

bdsullivan commented 9 years ago

Made some additional modifications to the summary of additions and title of the pull request; approving merge.