Struct EdgeListGraphScanner

Source
pub struct EdgeListGraphScanner<U: IterScan<Output = usize>, T: IterScan> { /* private fields */ }

Implementations§

Source§

impl<U: IterScan<Output = usize>, T: IterScan> EdgeListGraphScanner<U, T>

Source

pub fn new(vsize: usize, esize: usize) -> Self

Examples found in repository?
crates/aizu_online_judge/src/grl/grl_2_b.rs (line 12)
9pub fn grl_2_b(reader: impl Read, mut writer: impl Write) {
10    let s = read_all_unchecked(reader);
11    let mut scanner = Scanner::new(&s);
12    scan!(scanner, vs, es, root, (graph, w): @EdgeListGraphScanner::<usize, i64>::new(vs, es));
13    let res = graph.minimum_spanning_arborescence::<AdditiveOperation<_>, _>(root, |u| w[u]);
14    writeln!(writer, "{}", res.unwrap().0).ok();
15}
More examples
Hide additional examples
crates/library_checker/src/graph/directedmst.rs (line 9)
6pub fn directedmst(reader: impl Read, mut writer: impl Write) {
7    let s = read_all_unchecked(reader);
8    let mut scanner = Scanner::new(&s);
9    scan!(scanner, n, m, s, (graph, w): @EdgeListGraphScanner::<usize, i64>::new(n, m));
10    let res = graph
11        .minimum_spanning_arborescence::<AdditiveOperation<_>, _>(s, |u| w[u])
12        .unwrap();
13    iter_print!(writer, res.0; @it res.1);
14}
crates/aizu_online_judge/src/grl/grl_2_a.rs (line 9)
6pub fn grl_2_a(reader: impl Read, mut writer: impl Write) {
7    let s = read_all_unchecked(reader);
8    let mut scanner = Scanner::new(&s);
9    scan!(scanner, vs, es, (graph, w): @EdgeListGraphScanner::<usize, u64>::new(vs, es));
10    let span = graph.minimum_spanning_tree(|&eid| w[eid]);
11    let ans = (0..es).map(|eid| w[eid] * span[eid] as u64).sum::<u64>();
12    writeln!(writer, "{}", ans).ok();
13}

Trait Implementations§

Source§

impl<U: IterScan<Output = usize>, T: IterScan> MarkedIterScan for EdgeListGraphScanner<U, T>

Source§

type Output = (EdgeListGraph, Vec<<T as IterScan>::Output>)

Source§

fn mscan<'a, I: Iterator<Item = &'a str>>( self, iter: &mut I, ) -> Option<Self::Output>

Auto Trait Implementations§

§

impl<U, T> Freeze for EdgeListGraphScanner<U, T>

§

impl<U, T> RefUnwindSafe for EdgeListGraphScanner<U, T>

§

impl<U, T> Send for EdgeListGraphScanner<U, T>

§

impl<U, T> Sync for EdgeListGraphScanner<U, T>

§

impl<U, T> Unpin for EdgeListGraphScanner<U, T>

§

impl<U, T> UnwindSafe for EdgeListGraphScanner<U, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.