mggg / VoteKit

A Swiss Army Knife for computational social choice research
https://votekit.readthedocs.io/en/latest/
MIT License
10 stars 12 forks source link

Ballot graph overhaul #100

Closed cdonnay closed 11 months ago

cdonnay commented 11 months ago

Sorry for the length and number of changes here, but I was finding the BallotGraph object to not really be working as intended. High level summary of changes:

  1. Change complete parameter to allow_partial in __init__. If allow_partial is True, BallotGraph constructs all possible ballot types. If False, it only generates full linear orderings.
  2. Add fix_short parameter to __init__. Gives the user the option to change ballots of length n-1 to n.
  3. Add several parameters to draw. to_display lets the user specify a boolean function on nodes to be drawn. neighborhoods and show_cast are parameters that give common display functions.
  4. Added/replaced necessary test functions.
  5. Changed node_data to node_weights since that is the only kind of data it was storing.

@jamesturk @drdeford @jgibson517 @jennjwang @ziglaser

cdonnay commented 11 months ago

Updated the draw method to ensure labels do not go over the edge of the plot.