Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix directed gnp_random_graph #954

Merged
merged 21 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add try_into for usize to isize
  • Loading branch information
enavarro51 committed Nov 24, 2023
commit fd7544a9e10ecded245780b2771910b8c12794da
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ fixes:
Fixed an issue where the :func:`~rustworkx.generators.directed_gnp_random_graph`
and the :func:`~rustworkx-core.generators.gnp_random_graph` for directed graphs
produced a graph where lower node numbers had only a small number of edges
compared to what was expected and the output was therefore not random.
compared to what was expected.
2 changes: 1 addition & 1 deletion rustworkx-core/src/generators/random_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ where
}
}
} else {
let num_nodes = num_nodes as isize;
let num_nodes: isize = num_nodes.try_into().map_err(|_| InvalidInputError).unwrap();
let lp: f64 = (1.0 - probability).ln();
let between = Uniform::new(0.0, 1.0);

Expand Down