feat: add strict parameter to get_condorcet_cycles (#327)#330
Merged
peterrrock2 merged 4 commits intoFeb 27, 2026
Conversation
peterrrock2
requested changes
Feb 26, 2026
| strict_edges.append((u, v, d)) | ||
|
|
||
| graph_to_use = nx.DiGraph() | ||
| graph_to_use.add_nodes_from(self.pairwise_graph.nodes) |
Collaborator
There was a problem hiding this comment.
Suggested change
| graph_to_use.add_nodes_from(self.pairwise_graph.nodes) |
Since we are looking for cycles, we don't need to worry about isolated nodes, and the add_edges_from method will add the nodes that are missing anyway.
Comment on lines
+366
to
+368
| for u, v, d in self.pairwise_graph.edges(data=True): | ||
| if d.get("weight", 0) > 0: | ||
| strict_edges.append((u, v, d)) |
Collaborator
There was a problem hiding this comment.
Suggested change
| for u, v, d in self.pairwise_graph.edges(data=True): | |
| if d.get("weight", 0) > 0: | |
| strict_edges.append((u, v, d)) | |
| for u, v, data in self.pairwise_graph.edges(data=True): | |
| if data.get("weight", 0) > 0: | |
| strict_edges.append((u, v, data)) |
personal preference: more explicit variable names
Comment on lines
+351
to
+357
| Returns a list of condorcet cycles in the graph. | ||
|
|
||
| A cycle is defined as any cycle of length greater than 2. | ||
|
|
||
| Args: | ||
| strict (bool, optional): If True, only considers strict wins (weight > 0). | ||
| If False, includes ties (weak condorcet cycles). Defaults to False. |
Collaborator
There was a problem hiding this comment.
Thank you for styling this!
peterrrock2
approved these changes
Feb 27, 2026
Collaborator
peterrrock2
left a comment
There was a problem hiding this comment.
Looks good! Thanks!
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #327