| Crates.io | perty |
| lib.rs | perty |
| version | 0.0.1 |
| created_at | 2026-01-06 15:04:41.311073+00 |
| updated_at | 2026-01-06 15:04:41.311073+00 |
| description | A implementation of the Programme Evaluation and Review Technique (PERT). |
| homepage | |
| repository | |
| max_upload_size | |
| id | 2026039 |
| size | 46,463 |
A crate for constructing and analysing Program Evaluation and Review Technique (PERT) task graphs. The library provides the ability to run a single PERT analysis or a Monte-Carlo analysis where the solver can perform multiple runs and sampling from the distributions assigned to the tasks..
This example comes from the wikipedia page so you can check the results with the ones displayed on their page.

More examples can be found in the examples folder in the GitHub repo.
use perty::{Duration, Pert, PostProcess, Task};
fn main() {
// Create the tasks. We are using the Task struct provided by the library
// that implements `TryIntoPertTask` and features the minimum data required
// for the analysis.
// The crate provides the `TryIntoPertTask` trait that enables
// users to keep their task data structures which are likely to
// contain much more metadata relating to the task but not necessary
// for a PERT analysis.
let a = Task::new(
"A".to_string(),
vec![],
Duration::Pert {
optimistic: 2.,
most_likely: 4.,
pessimistic: 6.,
},
);
let b = Task::new(
"B".to_string(),
vec![],
Duration::Pert {
optimistic: 3.,
most_likely: 5.,
pessimistic: 9.,
},
);
let c = Task::new(
"C".to_string(),
vec!["A".to_string()],
Duration::Pert {
optimistic: 4.,
most_likely: 5.,
pessimistic: 7.,
},
);
let d = Task::new(
"D".to_string(),
vec!["A".to_string()],
Duration::Pert {
optimistic: 4.,
most_likely: 5.,
pessimistic: 10.,
},
);
let e = Task::new(
"E".to_string(),
vec!["B".to_string(), "C".to_string()],
Duration::Pert {
optimistic: 4.,
most_likely: 5.,
pessimistic: 7.,
},
);
let f = Task::new(
"F".to_string(),
vec!["D".to_string()],
Duration::Pert {
optimistic: 3.,
most_likely: 4.,
pessimistic: 8.,
},
);
let g = Task::new(
"G".to_string(),
vec!["E".to_string()],
Duration::Pert {
optimistic: 3.,
most_likely: 5.,
pessimistic: 8.,
},
);
// Put the tasks into a vec.
let tasks = vec![a, b, c, d, e, f, g];
for t in tasks.iter() {
println!("{}: {:?}", t.id, t.duration);
}
// The PERT trait provides a solve_pert function for types that
// implement the TryIntoPertTask trait.
let nodes = tasks.solve_pert(1_000).unwrap();
// Access the results. Which could be added back to your tasks.
for n in nodes.iter() {
println!("{}: {:.2} {}", n.id, n.slack(), n.is_critical());
}
println!("Total Duration: {:.2}", nodes.project_duration());
}
Help is provided by:
perty pert --help
The CLI can accept a file path to a json description of your project and output the results to another file path set by the user.
perty pert <INP> <OUT> [MAX_ITER]
Please consider supporting the crate by: