CHALLENGING MEMORY AND TIME COMPLEXITY OF
SUBGRAPH ISOMORPHISM PROBLEM WITH VF3
OVERVIEW
Challenging memory and time complexity of subgraph isomorphism problem with VF3
GRAPH MATCHING ALGORITMS
▸ Exact Graph Matching
▸ Structure Preserving Mapping
▸ Adjacency-preserving
▸ Non-adjacency preserving
▸ NP-Complete Problem
Challenging memory and time complexity of subgraph isomorphism problem with VF3
SIMILARITY BY
SUBGRAPH ISOMORPHISM
Challenging memory and time complexity of subgraph isomorphism problem with VF3
WHAT IS SUBGRAPH ISOMORPHISM?
▸ Given a graph:
▸ Is it inside another graph?
▸ How many times?
▸ Where?
▸ Common applications:
▸ Pattern search or Graph querying
▸ Graph learning algorithms
▸ Graph clustering
2
3
B
C
4
B
A
D
1
5
3
4
C
B
B
2
5
D
D
A
1
6
Challenging memory and time complexity of subgraph isomorphism problem with VF3
WHERE DID WE BEGIN FROM? VF2!
▸ A (sub) graph isomorphism algorithm for matching large graphs - IEEE
Transactions on PAMI - L. Cordella, P. Foggia, C. Sansone, M. Vento –
2004.
▸ VF2 is currently used in:
▸ Boost C++ library
▸ Networkx python library
▸ MIT Courses
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: IN BRIEF
Inherited
▸ State Space Representation
▸ Each state is partial solution
▸ A goal is consistent complete
solution
▸ Depth-First search with
backtracking
▸ State space as a tree by a total
order relationship
▸ Feasibility rules to explore the
space
▸ Consistent states only
▸ 2-levels Look-ahead
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: IN BRIEF
Inherited
New
▸ State Space Representation
▸ Each state is partial solution
▸ A goal is consistent complete
solution
▸ Pattern Pre-processing
▸ The first graph is explored
before starting.
▸ Straightened look-ahead
▸ Node classification
▸ Structural and Semantic
features
▸ Depth-First search with
backtracking
▸ State space as a tree by a total
order relationship
▸ Feasibility rules to explore the
space
▸ Consistent states only
▸ 2-levels Look-ahead
▸ New state transition function
▸ Significantly reduced the set
where the next pairs are
searched.
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: IN BRIEF
Inherited
New
▸ State Space Representation
▸ Each state is partial solution
▸ A goal is consistent complete
solution
▸ Pattern Pre-processing
▸ The first graph is explored
before starting.
▸ Straightened look-ahead
▸ Node classification
▸ Structural and Semantic
features
▸ Depth-First search with
backtracking
▸ State space as a tree by a total
order relationship
▸ Feasibility rules to explore the
space
▸ Consistent states only
▸ 2-levels Look-ahead
Unchanged Complexity
▸ Linear in space
▸ Quadratic in time (avg)
▸ New state transition function
▸ Significantly reduced the set
where the next pairs are
searched.
But faster!
(From 10 to 1000 times)
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (WARMUP)
1. Classify the nodes
▸ Structural features
▸ Semantic features
2. Order the nodes
2
3
3
4
B
C
C
B
4
B
A
D
1
5
B
D
2
Pattern (G1)
D
A
1
6
Target (G2)
▸
Most constrained first
▸
Most rare first
Class
1
2
3
4
▸
Generate a node sequence
Label
D
B
C
A
3. Pre-process the pattern
▸ Prepare the structures
N = {3, 1, 5, 2, 4}
▸ Generate a coverage tree
C
1
A
2
B
5
4
3
B
5
Challenging memory and time complexity of subgraph isomorphism problem with VF3
D
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
State
S0
Mapping
M(S0)=⍉
▸ Iteratively add a new matching
couple by following the
exploration sequence
▸ Check for the consistence
▸ Move through consistent states
2
3
B
C
4
N = {3, 1, 5, 2, 4}
3
4
C
B
B
D
2
5
D
A
1
6
B
G1(S0)
G2(S0)
A
D
1
5
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
State
S0
S1
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
▸ Check for the consistence
▸ Move through consistent state
N = {3, 1, 5, 2, 4}
3
3
C
C
2
3
B
C
B
A
D
1
5
4
B
B
2
D
A
1
6
G1(S1)
4
G2(S1)
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
State
S0
S1
▸ Generate new states
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
▸ Iteratively add a new matching
couple by following the
exploration sequence
2
1
4
6
▸ Check for the consistence
B
D
B
A
▸ Move through consistent state
3
N = {3, 1, 5, 2, 4}
C
3
2
3
B
C
B
C
A
D
1
5
4
B
B
2
D
A
1
6
G1(S1)
4
G2(S1)
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
State
S0
S1
S2
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
M(S2) = {(3, 3), (1, 6)}
▸ Check for the consistence
▸ Move through consistent state
3
N = {3, 1, 5, 2, 4}
C
3
2
3
B
C
B
C
A
D
1
5
4
B
2
A
A
1
B
G1(S2)
D
4
G2(S2)
6
G1
3
4
C
B
B
2
1
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
State
S0
S1
S2
S3
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
M(S2) = {(3, 3), (1, 6)}
M(S3) = {(3, 3), (1, 6), (5, 1)}
▸ Check for the consistence
▸ Move through consistent state
N = {3, 1, 5, 2, 4}
3
3
C
C
2
3
B
C
B
A
D
1
5
4
B
B
2
A
D
D
A
1
5
1
6
G1(S3)
4
G2(S3)
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
State
S0
S1
S2
S3
S4
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
M(S2) = {(3, 3), (1, 6)}
M(S3) = {(3, 3), (1, 6), (5, 1)}
M(S4) = {(3, 3), (1, 6), (5, 1), (2, 2)}
▸ Check for the consistence
▸ Move through consistent state
N = {3, 1, 5, 2, 4}
2
3
3
B
C
C
B
B
2
A
D
1
5
G1(S4)
2
3
B
C
4
B
B
4
2
D
A
1
6
G2(S4)
A
D
1
5
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
▸ Check for the consistence
State
S0
S1
S2
S3
S4
S5
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
M(S2) = {(3, 3), (1, 6)}
M(S3) = {(3, 3), (1, 6), (5, 1)}
M(S4) = {(3, 3), (1, 6), (5, 1), (2, 2)}
M(S5) = {(3, 3), (1, 6), (5, 1), (2, 4)}
▸ Move through consistent state
N = {3, 1, 5, 2, 4}
2
3
3
4
B
C
C
B
2
3
B
C
B
A
D
1
5
4
B
A
D
D
A
1
5
1
6
G1(S5)
G2(S5)
4
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (EXPLORATION)
4. Exploring the state space
▸ Start from an empty solution
▸ Generate new states
▸ Iteratively add a new matching
couple by following the
exploration sequence
▸ Check for the consistence
State
S0
S1
S2
S3
S4
S5
S6
Mapping
M(S0)=⍉
M(S1) = {(3, 3)}
M(S2) = {(3, 3), (1, 6)}
M(S3) = {(3, 3), (1, 6), (5, 1)}
M(S4) = {(3, 3), (1, 6), (5, 1), (2, 2)}
M(S5) = {(3, 3), (1, 6), (5, 1), (2, 4)}
M(S6) = {(3, 3), (1, 6), (5, 1), (2, 4), (4, 2)}
▸ Move through consistent state
N = {3, 1, 5, 2, 4}
2
3
3
4
B
C
C
B
4
B
A
D
1
5
G1(S6)
D
A
1
6
G2(S6)
3
B
C
4
B
B
2
2
A
D
1
5
G1
3
4
C
B
B
2
Candidates of G2
Challenging memory and time complexity of subgraph isomorphism problem with VF3
5
D
D
A
1
6
G2
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
for consistency?
Feasibility Rules
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Core Rule
{(3,3),(1,6)}
3
3
C
C
A
1
A
6
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Core Rule
{(3,3),(1,6)}
3
3
C
C
A
1
A
6
Core Sets
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Core Rule
{(3,3),(1,6)}
3
3
C
C
A
1
A
6
(5,4)
3
3
4
C
C
B
A
D
A
1
5
6
Semantic
Inconsistence
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Core Rule
{(3,3),(1,6)}
3
3
C
C
A
1
(5,4)
A
6
3
3
4
C
C
B
A
D
A
1
5
6
3
3
C
C
(2,2)
2
3
B
C
Semantic
Inconsistence
Structural
3
C
B
A
D
D
A
A
D
1
5
1
6
1
5
2
D
A
1
6
Inconsistence
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Look-ahead Rules
3
3
C
C
A
1
A
6
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Look-ahead Rules
2
2
B
B
3
3
4
C
C
4
B
B
5
D
5
A
1
A
6
D
D
1
Terminal Sets
Challenging memory and time complexity of subgraph isomorphism problem with VF3
VF3: HOW DOES IT WORK? (FEASIBILITY)
How do we check
Feasibility Rules
for consistency?
Look-ahead Rules
2
2
B
B
3
3
4
C
C
4
B
B
5
D
5
A
1
A
6
D
D
1
Terminal Sets
Challenging memory and time complexity of subgraph isomorphism problem with VF3
WWW.MIVIA.UNISA.IT
Challenging memory and time complexity of subgraph isomorphism problem with VF3
© Copyright 2026 Paperzz