Fix infinite loops in graph generation logic#1
Conversation
- Fixes an issue where Bipartite graph generation could hang indefinitely if the randomly selected partition size could not support the requested number of edges. Now calculates the valid range of partition sizes based on `m`. - Adds strict validation for `maxEdges` for DAG, Bipartite, and Simple graphs to prevent impossible generation requests from looping forever. - Improves connectivity logic for Bipartite and DAG graphs to respect their structural properties (e.g., Bipartite sets, DAG topological order). - Enforces `directed: true` for DAG generation if not specified.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
This change fixes the reported infinite loop bugs in
G.graph.Previously, Bipartite graph generation selected a partition size randomly. If the selected partition was too unbalanced (e.g., 1 node in set A, 9 in set B), it might not support the requested number of edges, causing the rejection sampling loop to run forever. The fix mathematically calculates the valid range of partition sizes that can support
medges and samples from that range.Additionally, the change adds strict validation for the maximum possible edges for all graph types (DAG, Bipartite, Simple) to ensure that impossible requests fail fast with an error instead of hanging.
The connectivity logic for DAG and Bipartite graphs was also improved to ensure that the initial connected edges respect the specific constraints of those graph types (e.g., edges only between partitions for Bipartite, edges respecting topological sort for DAG).
PR created automatically by Jules for task 9037485127498503475 started by @yviscool