Does anyone know of existing python code to find the Smith Set of candidates, given a pairwise array?
I don’t have time to write Python code right now, but here is the outline for an algorithm that should get you the Smith set:
- Start with an empty set (this will hold the solution) and empty queue.
- Find the Copelands winner. (If there is a tie, just add all tied candidates.) Add them to the set and queue.
- Loop until the queue is non-empty:
a. Dequeue the first candidate in the queue. Call that candidate C.
b. Find all the candidates that beat C. For each such candidate, if they have not already been added to the set, add them to the set and the queue.
- Once the queue is empty, the resulting set will be the Smith set.
Thanks, that’s pretty straightforward. I can whip that out pretty quick.
Correction: this should be beat or tie C.