Skip to content

Trait Rework: Unify *Count into GraphLen #554

@indietyp

Description

@indietyp

Unify EdgeCount and NodeCount into GraphLen, as it is unlikely that there are any cases where only one of them is implemented.

Count is also used in the contexts of iterators for getting the length while consuming the iterator.

pub struct Length {
	edges: usize,
	nodes: usize
}

impl Length {
	fn new() -> Self;
	fn edges() -> usize;
	fn nodes() -> usize;
}

pub trait GraphEdgeLen {
	fn edges_len(&self) -> usize;
}

pub trait GraphNodeLen {
	fn nodes_len(&self) -> usize;
}

pub trait GraphLen: GraphEdgeLen + GraphNodeLen {
	fn len(&self) -> Length {
		Length {edges: self.edges_len(), nodes: self.nodes_len()}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions