Skip to content

Commit f4e741c

Browse files
committed
fix doc test
1 parent 55db074 commit f4e741c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

algo/re_rooting_dp/src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
/// `fold(p, ch, e)` は親頂点 `p` に子の頂点 `ch` を辺 `e` 含めてマージした結果を返すよう実装する
44
///
55
/// ```no_run
6-
/// // 木の直径を求める例
6+
/// // 各頂点から最も遠い頂点までの距離を求める例
7+
///
8+
/// use re_rooting_dp::re_rooting_dp;
79
///
810
/// struct E(u64);
911
/// #[derive(Clone)]
1012
/// struct V(u64);
13+
///
14+
/// let n: usize = todo!();
15+
/// let edges: Vec<(usize, usize, E)> = todo!();
1116
///
12-
/// re_rooting_dp(
17+
/// let farthest = re_rooting_dp(
1318
/// n,
1419
/// &edges,
1520
/// // new
@@ -18,9 +23,9 @@
1823
/// },
1924
/// // fold
2025
/// |p, ch, e| {
21-
/// p.0.max(ch.0 + e.0)
26+
/// V(p.0.max(ch.0 + e.0))
2227
/// }
23-
/// )
28+
/// );
2429
/// ```
2530
pub fn re_rooting_dp<E, V, F, G>(n: usize, edges: &[(usize, usize, E)], new: F, fold: G) -> Vec<V>
2631
where

0 commit comments

Comments
 (0)