public class RGraph extends Object
Example:
G1 : C-C=O and G2 : C-C-C=0 1 2 3 1 2 3 4
The resulting RGraph(G1,G2) will contain 3 nodes:
Once the RGraph has been built from the two compared graphs it becomes a very interesting tool to perform all kinds of structural search (isomorphism, substructure search, maximal common substructure,....).
The search may be constrained by mandatory elements (e.g. bonds that have to be present in the mapped common substructures).
Performing a query on an RGraph requires simply to set the constrains (if any) and to invoke the parsing method (parse())
The RGraph has been designed to be a generic tool. It may be constructed from any kind of source graphs, thus it is not restricted to a chemical context.
The RGraph model is independent from the CDK model and the link between both model is performed by the RTools class. In this way the RGraph class may be reused in other graph context (conceptual graphs,....)
Important note: This implementation of the algorithm has not been optimized for speed at this stage. It has been written with the goal to clearly retrace the principle of the underlined search method. There is room for optimization in many ways including the the algorithm itself.
This algorithm derives from the algorithm described in (Tonnelier, C. et. al.. Tetrahedron Comput. Methodol.. 1990. 3) and modified in the thesis of T. Hanser (Hanser, Th., Apprentissage automatique de méthodes de synthèse à partir d'exemples, 1993, ?Institute?).
Constructor and Description |
---|
RGraph()
Constructor for the RGraph object and creates an empty RGraph.
|
Modifier and Type | Method and Description |
---|---|
void |
addNode(RNode newNode)
Adds a new node to the RGraph.
|
List<RMap> |
bitSetToRMap(BitSet set)
Converts a RGraph bitset (set of RNode)
to a list of RMap that represents the
mapping between to substructures in G1 and G2
(the projection of the RGraph bitset on G1
and G2).
|
void |
clear()
Reinitialisation of the TGraph.
|
int |
getFirstGraphSize()
Returns the size of the first of the two
compared graphs.
|
List<RNode> |
getGraph()
Returns the graph object of this RGraph.
|
int |
getSecondGraphSize()
Returns the size of the second of the two
compared graphs.
|
List<BitSet> |
getSolutions()
Returns the list of solutions.
|
void |
parse(BitSet c1,
BitSet c2,
boolean findAllStructure,
boolean findAllMap)
Parsing of the RGraph.
|
BitSet |
projectG1(BitSet set)
Projects a RGraph bitset on the source graph G1.
|
BitSet |
projectG2(BitSet set)
Projects a RGraph bitset on the source graph G2.
|
void |
setAllMap(boolean findAllMap)
Sets the 'finAllMap' option.
|
void |
setAllStructure(boolean findAllStructure)
Sets the 'AllStructres' option.
|
void |
setFirstGraphSize(int n1)
Sets the size of the first of the two
compared graphs.
|
void |
setMaxIteration(int it)
Sets the maxIteration for the RGraph parsing.
|
void |
setSecondGraphSize(int n2)
Returns the size of the second of the two
compared graphs.
|
void |
setStart(long start) |
void |
setTimeout(long timeout)
Sets the time in milliseconds until the substructure search will be breaked.
|
String |
toString()
Returns a string representation of the RGraph.
|
public RGraph()
public int getFirstGraphSize()
public int getSecondGraphSize()
public void setFirstGraphSize(int n1)
n1
- The size of the second of the two compared graphspublic void setSecondGraphSize(int n2)
n2
- The size of the second of the two compared graphspublic void clear()
public List<RNode> getGraph()
public void addNode(RNode newNode)
newNode
- The node to add to the graphpublic void parse(BitSet c1, BitSet c2, boolean findAllStructure, boolean findAllMap)
c1
- constrain on the graph G1c2
- constrain on the graph G2findAllStructure
- true if we want all results to be generatedfindAllMap
- true is we want all possible 'mappings'public List<BitSet> getSolutions()
public List<RMap> bitSetToRMap(BitSet set)
set
- the BitSetpublic void setAllStructure(boolean findAllStructure)
findAllStructure
- public void setAllMap(boolean findAllMap)
findAllMap
- public void setMaxIteration(int it)
it
- The new maxIteration valuepublic String toString()
public BitSet projectG1(BitSet set)
set
- RGraph BitSet to projectpublic BitSet projectG2(BitSet set)
set
- RGraph BitSet to projectpublic void setTimeout(long timeout)
timeout
- Time in milliseconds. -1 to ignore the timeout.public void setStart(long start)
start
- The start time in milliseconds.Copyright © 2021. All rights reserved.