use precedence_net::{Network, Result}; fn main() -> Result<()> { let mut network_builder = Network::builder(); network_builder.add_activity("Design", 5.0)?; network_builder.add_activity("Develop", 6.0)?; network_builder.add_activity("Document", 4.0)?; network_builder.add_activity("Deploy", 1.0)?; network_builder.add_activity("Train", 3.0)?; network_builder.add_activity("Test", 4.0)?; network_builder.connect("Design", "Develop")?; network_builder.connect("Design", "Document")?; network_builder.connect("Develop", "Test")?; network_builder.connect("Develop", "Train")?; network_builder.connect("Test", "Deploy")?; network_builder.connect("Train", "Deploy")?; network_builder.connect("Document", "Deploy")?; let network = Network::try_from(network_builder)?; println!("Activity | Earliest Start | Earliest Finish | Latest Start | Latest Finish | Total Float | Free Float | Critical Path"); println!("---------------------------------------------------------------------------------------------------------------------"); for activity in network.activities()? { println!( "{:^8} | {:>14} | {:>15} | {:>12} | {:>13} | {:>11} | {:>10} | {:^14}", activity, network.earliest_start(activity)?, network.earliest_finish(activity)?, network.latest_start(activity)?, network.latest_finish(activity)?, network.total_float(activity)?, network.free_float(activity)?, network.on_critical_path(activity)?, ); } Ok(()) }