From fba9a90cfc6aca2a26cce72f55fb261789139781 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 16 Oct 2026 14:01:01 +0800 Subject: new start Now I tested and discussed with claude, and had a working version of this project. The rest is to port the claude version to my own writings. So this serves as the starting point before that attempt. In the new attempt the design is better, and a number of bugs were found and supposedly fixed, so let us see how this goes at the end. --- graph/src/labelled/double.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'graph/src/labelled/double.rs') diff --git a/graph/src/labelled/double.rs b/graph/src/labelled/double.rs index b01a13b..12d0e54 100644 --- a/graph/src/labelled/double.rs +++ b/graph/src/labelled/double.rs @@ -158,6 +158,7 @@ impl Graph for DLGraph { let mut file = std::fs::File::options() .write(true) .create(true) + .truncate(true) .open(&filename)?; use std::io::Write; @@ -408,21 +409,12 @@ impl LabelExtGraph for DLGraph { if !set.contains(&label) { flat.push((label, to)); by_target.get_mut(&to).unwrap().insert(label); - by_label - .entry(label) - .or_insert_with(Default::default) - .insert(to); + by_label.entry(label).or_default().insert(to); } } else { flat.push((label, to)); - by_target - .entry(to) - .or_insert_with(Default::default) - .insert(label); - by_label - .entry(label) - .or_insert_with(Default::default) - .insert(to); + by_target.entry(to).or_default().insert(label); + by_label.entry(label).or_default().insert(to); } } -- cgit v1.2.3-18-g5258