SubgraphAlgorithm

Trait SubgraphAlgorithm 

Source
pub trait SubgraphAlgorithm<'a, NodeWeight, EdgeWeight, NRef, ERef, N2Ref, E2Ref, PatternGraphType, BaseGraphType>
where NRef: Copy + Eq + Hash, N2Ref: Copy + Eq + Hash, PatternGraphType: PatternGraph<NodeWeight, EdgeWeight, NodeRef = NRef, EdgeRef = ERef>, BaseGraphType: Graph<NodeWeight, EdgeWeight, NodeRef = N2Ref, EdgeRef = E2Ref>,
{ // Required method fn eval( pattern_graph: &'a PatternGraphType, base_graph: &'a BaseGraphType, ) -> Vec<MatchedGraph<'a, NodeWeight, EdgeWeight, PatternGraphType>> ; }
Expand description

The SubgraphAlgorithm trait specifies any algorithm that can solve the subgraph isomorphism problem. Solving this problem lies at the core of graph pattern matching.

Required Methods§

Source

fn eval( pattern_graph: &'a PatternGraphType, base_graph: &'a BaseGraphType, ) -> Vec<MatchedGraph<'a, NodeWeight, EdgeWeight, PatternGraphType>>

Creates and evaluates a query to find all subgraphs of base_graph that match pattern_graph.

§Input:

Two graphs, base_graph (any Graph instance), and pattern_graph (a PatternGraph instance). base_graph and pattern_graph share both node and edge types (NodeWeight/EdgeWeight).

pattern_graph uses NRef and ERef for references over nodes and edges. base_graph uses N2Ref and E2Ref respectively.

Both pattern_graph and base_graph currently have the same lifetime ’a.

§Output:

A reference to a vector of MatchedGraph, whose nodes and edges have NodeWeight/EdgeWeight types, and its references NRef/ERef. We want to access matched elements of the base graph by references we set in the pattern graph.

An implementation find_subgraphs should guarantee set semantics, so that every found graph pattern occurs only once.

If pattern_graph is an empty graph without nodes (or edges), or if no subgraph of base_graph can be matched to it, then we return an empty vector.

§Panics:

base_graph is a directed graph, and pattern_graph is not, or vice versa.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, NodeWeight, EdgeWeight, NRef, ERef, N2Ref, E2Ref, P, B> SubgraphAlgorithm<'a, NodeWeight, EdgeWeight, NRef, ERef, N2Ref, E2Ref, P, B> for VfState<'a, NodeWeight, EdgeWeight, NRef, ERef, N2Ref, E2Ref, P, B>
where NRef: Copy + Hash + Ord + Debug, N2Ref: Copy + Hash + Eq + Debug, ERef: Copy + Hash + Eq + Debug, E2Ref: Copy + Debug, P: PatternGraph<NodeWeight, EdgeWeight, NodeRef = NRef, EdgeRef = ERef>, B: Graph<NodeWeight, EdgeWeight, NodeRef = N2Ref, EdgeRef = E2Ref>,