Skip to content

Make the Rust API more lazy #138

@hhirtz

Description

@hhirtz

Right now algorithms are run eagerly:

coupe::Rcb { iter_count: 2, ..Default::default() }
    .partition(ids, (points, weights))
    .unwrap();
coupe::KMeans::default()
    .partition(ids, (points, weights))
    .unwrap();
coupe::FiducciaMattheyses { max_imbalance: Some(0.05), ..Default::default() }
    .partition(ids, (adjacency, weights))
    .unwrap();

Could coupe make do with less computations? It would mean we'd need to have a global view of the algorithm chain, something used like iterators?

trait IntoPartitioner {
    fn into_partitioner(&mut self) -> Partitioner<'_>;
}

ids
    .partition()
    .with_vertex_coords(points)
    .with_vertex_weights(weights)
    .with_adjacency(adjacency)
    .rcb(coupe::Rcb { iter_count: 2, ..Default::default() })
    .k_means(Default::default())
    .fidducia_mattheyses(coupe::FiducciaMattheyses {
        max_imbalance: Some(0.05),
        ..Default::default()
    })
    .collect() // ?
    .unwrap()?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions