Modify GUI for better readability, clean up

This commit is contained in:
2025-03-20 15:29:19 +01:00
parent 5d81549ac0
commit fdcb646bd2
7 changed files with 428 additions and 72 deletions

View File

@@ -1,15 +1,18 @@
use eframe::{run_native, App, CreationContext, NativeOptions, Frame};
use egui::{CentralPanel, SidePanel, Context};
use egui_graphs::{GraphView, Graph, SettingsStyle, LayoutRandom, LayoutStateRandom};
use egui_graphs::{DefaultEdgeShape, DefaultNodeShape, Graph, GraphView, LayoutRandom, LayoutStateRandom, SettingsStyle};
use algorithms::ford_fulkerson;
use petgraph::Directed;
use random_generator::MaxflowProblem;
use layout::CustomEdgeShape;
use crate::algorithms::ford_fulkerson;
mod random_generator;
mod algorithms;
mod graph;
mod layout;
pub struct MaxflowApp {
g: Graph<(f32, f32), (u64, u64)>,
g: Graph<(f32, f32), (u64, u64), Directed, u32, DefaultNodeShape, CustomEdgeShape>,
p: MaxflowProblem,
node_count: u64,
max_capacity: u64,
@@ -26,7 +29,7 @@ impl App for MaxflowApp {
fn update(&mut self, ctx: &Context, _: &mut Frame) {
ctx.set_theme(egui::Theme::Light);
CentralPanel::default().show(ctx, |ui| {
ui.add(&mut GraphView::<_, _, _, _, _, _, LayoutStateRandom, LayoutRandom>::new(&mut self.g).with_styles(&SettingsStyle::default().with_labels_always(true)));
ui.add(&mut GraphView::<_, _, _, _, _, CustomEdgeShape, LayoutStateRandom, LayoutRandom>::new(&mut self.g).with_styles(&SettingsStyle::default().with_labels_always(true)));
});
SidePanel::right("right_panel")
.min_width(200.)