pub fn subisomorphic_lad(
pattern: &Graph,
target: &Graph,
domains: Option<&[Vec<u32>]>,
induced: bool,
) -> IgraphResult<LadSubisomorphism>Expand description
Decide whether pattern is isomorphic to a subgraph of target using the
LAD algorithm, returning the first embedding found.
pattern and target must agree on directedness. Multi-edges are
rejected; self-loops are allowed. The optional domains restricts each
pattern vertex (in id order) to an explicit list of compatible target
vertices — useful for colour-constrained matching. When induced is
true, non-edges of the pattern must map to non-edges of the target
(induced subgraph); when false, only pattern edges must be preserved
(monomorphism).
Port of igraph_subisomorphic_lad with maps == NULL (first-solution
mode).
§Examples
use rust_igraph::{Graph, subisomorphic_lad};
// A triangle pattern embeds into K4.
let mut target = Graph::new(4, false)?;
for (u, v) in [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)] {
target.add_edge(u, v)?;
}
let mut pattern = Graph::new(3, false)?;
for (u, v) in [(0, 1), (1, 2), (2, 0)] {
pattern.add_edge(u, v)?;
}
let res = subisomorphic_lad(&pattern, &target, None, false)?;
assert!(res.iso);
assert_eq!(res.map.len(), 3);