public class VF2State extends Object implements State
State
implementation for testing isomorphism using the VF2
algorithm's logic. Note that this implementation requires that the graphs
have contiguous vertex indices (beginning at 0 to g.order()
-1.
This implementation is based on the vf2_state implemenation in VFLib.
Modifier | Constructor and Description |
---|---|
|
VF2State(Graph<? extends Edge> g1,
Graph<? extends Edge> g2)
Creates a new
VF2State with an empty mapping between the two
graphs. |
protected |
VF2State(VF2State copy) |
Modifier and Type | Method and Description |
---|---|
void |
addPair(int node1,
int node2)
Adds the two vertices to this
State 's vertex mapping. |
protected boolean |
areCompatableVertices(int v1,
int v2) |
protected boolean |
areCompatibleEdges(int v1,
int v2,
int v3,
int v4) |
void |
backTrack()
Undoes the mapping added in the prior call to
addPair . |
VF2State |
copy()
Makes a shallow copy of the content of this state.
|
Graph<? extends Edge> |
getGraph1()
Returns the first graph being matched
|
Graph<? extends Edge> |
getGraph2()
Returns the first graph being matched
|
Map<Integer,Integer> |
getVertexMapping()
Returns the current mapping between vertices.
|
boolean |
isDead()
Returns
true if the current state of mapping cannot proceed
because some invalid mapping has occurred and no further pairs would
result in an isomorphic match. |
boolean |
isFeasiblePair(int node1,
int node2)
Returns
true if mapping node1 to node2 would
preseve the isomorphism between the graphs to the extend that their
vertices have been mapped thusfar. |
boolean |
isGoal()
Returns
true if all the vertices have been mapped. |
Pair<Integer> |
nextPair(int prevN1,
int prevN2)
Returns the next candidate for isomorphic matching given these prior two
vertices that were matched.
|
public VF2State(Graph<? extends Edge> g1, Graph<? extends Edge> g2)
VF2State
with an empty mapping between the two
graphs.protected VF2State(VF2State copy)
public Pair<Integer> nextPair(int prevN1, int prevN2)
prevN1
and prevN1
are
NULL_NODE
, this should return the initial candidate.protected boolean areCompatibleEdges(int v1, int v2, int v3, int v4)
protected boolean areCompatableVertices(int v1, int v2)
public boolean isFeasiblePair(int node1, int node2)
true
if mapping node1
to node2
would
preseve the isomorphism between the graphs to the extend that their
vertices have been mapped thusfar.isFeasiblePair
in interface State
public void addPair(int node1, int node2)
State
's vertex mapping.public boolean isGoal()
true
if all the vertices have been mapped. Equivalently,
returns true
if the graphs are isomorphic.public boolean isDead()
true
if the current state of mapping cannot proceed
because some invalid mapping has occurred and no further pairs would
result in an isomorphic match.public Map<Integer,Integer> getVertexMapping()
getVertexMapping
in interface State
public VF2State copy()
Copyright © 2012. All Rights Reserved.