vf3lib-rs — Rust Bindings for vf3lib
Rust FFI bindings to the VF3/VF3L/VF3P subgraph isomorphism algorithms from MIVIA Lab.
Features
- High Performance: Direct bindings to the optimized C++ implementation
- Multiple Algorithms: VF3 (full heuristics), VF3L (lightweight), and VF3P (parallel)
- Flexible Matching: Both node-induced and edge-induced subgraph isomorphism
- Graph Formats: Supports VF legacy and edge list formats
- Safe Rust API: Type-safe wrapper around the C++ library
Quick Start
use ;
// Run VF3 algorithm on graph files
let result = run_vf3?;
println!;
Algorithm Variants
VF3 — Full Heuristics
Best for medium to large dense graphs.
use ;
let result = run_vf3?;
VF3L — Lightweight
Best for small or sparse graphs (no look-ahead).
use ;
let result = run_vf3l?;
VF3P — Parallel (Linux only)
For computationally hard instances. Requires Linux due to thread affinity APIs.
use ;
let mut par_opts = default;
par_opts.num_threads = 4;
let result = run_vf3p?;
Options
use ;
let opts = RunOptions ;
Builder API
For a more ergonomic interface:
use VF3Query;
let result = new
.edge_induced
.undirected
.run_light?; // Uses VF3L variant
Building
This crate requires a C++ compiler (GCC, Clang, or MSVC) to build the bundled vf3lib.
Testing
The crate includes comprehensive test coverage with 32 bundled graph files from the vf3lib repository, located in tests/data/. These range from small validation graphs to larger SI2 datasets, enabling thorough testing without any additional setup.
License
The Rust bindings are dual-licensed under MIT OR Apache-2.0.
The bundled vf3lib C++ headers are licensed under LGPL v3. See THIRD_PARTY_NOTICES.md for details and compliance information.