pub fn wl_subtree_kernel(
adj1: &[Vec<usize>],
labels1: &[u64],
adj2: &[Vec<usize>],
labels2: &[u64],
max_depth: usize,
) -> f64Expand description
Weisfeiler-Leman subtree kernel (1-WL).
Counts matching subtree patterns at each depth up to max_depth.
At each iteration, node labels are refined by hashing the multiset
of neighbor labels, capturing increasingly large subtree structure.
The kernel value is the inner product of the aggregated label histograms across all depths.
§Arguments
adj1- Adjacency list for graph 1labels1- Initial node labels for graph 1adj2- Adjacency list for graph 2labels2- Initial node labels for graph 2max_depth- Number of WL refinement iterations
§Example
use graphops::wl_subtree_kernel;
// Triangle graph
let adj = vec![vec![1, 2], vec![0, 2], vec![0, 1]];
let labels = vec![1, 1, 1];
let k = wl_subtree_kernel(&adj, &labels, &adj, &labels, 2);
assert!(k > 0.0);