-
Notifications
You must be signed in to change notification settings - Fork 441
Open
Labels
A-crateArea: Petgraph crate functionalityArea: Petgraph crate functionalityC-tracking-issueAn issue/PR that collects information about a broad development initiativeAn issue/PR that collects information about a broad development initiativeF-trait-reworkFeature: Trait ReworkFeature: Trait Rework
Milestone
Description
The tracking issue for the subgraph proposal, replacing visit::FilterEdge, EdgeFiltered, visit::FilterNode, NodeFiltered with a new crate petgraph-subgraph.
Instead of having multiple adapters that filter by a specific edge, that must be implemented, we choose to expose a single new graph type: Subgraph, which acts like any other graph but allows to exclude edges and noes from the graph.
pub trait Filter<T> {
fn call(&self, value: T) -> bool;
}
pub enum Include {
All,
Only(HashSet<T>) // <- or any other set
}
pub struct Subgraph<T> where T: GraphBase {
graph: T,
nodes: Include<T::NodeId>,
edges: Include<T::EdgeId>
}
impl Subgraph<T> {
// Include all. The name is not great
fn new(graph: T) -> Self;
// names TBD
fn only_include_edges<U>(&mut self, edges: U) where U: Filter<T::EdgeId>;
fn only_include_nodes<U>(&mut self, nodes: U) where U: Filter<T::NodeId>;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-crateArea: Petgraph crate functionalityArea: Petgraph crate functionalityC-tracking-issueAn issue/PR that collects information about a broad development initiativeAn issue/PR that collects information about a broad development initiativeF-trait-reworkFeature: Trait ReworkFeature: Trait Rework