$darkmode
DENOPTIM
denoptim.utils.GraphConversionTool Class Reference

Tool to convert string into graphs and into molecular representation. More...

Static Public Member Functions

static DGraph getGraphFromString (String strGraph, FragmentSpace fragSpace) throws DENOPTIMException
 Given a formatted string-like representation of a DENOPTIM graph create the corresponding DENOPTIMGraph object. More...
 
static DGraph getGraphFromString (String strGraph, boolean useMolInfo, FragmentSpace fragSpace) throws DENOPTIMException
 Given a formatted string-like representation of a DENOPTIM graph create the corresponding DENOPTIMGraph object. More...
 
static DefaultUndirectedGraph< Vertex, UndirectedEdgegetJGraphFromGraph (DGraph dg)
 Converts a DGraph into a simplified JGraphT DefaultUndirectedGraph. More...
 
static DefaultUndirectedGraph< Node, NodeConnectiongetJGraphKernelFromGraph (DGraph dg)
 Converts a DGraph into a simplified JGraphT DefaultUndirectedGraph. More...
 

Detailed Description

Tool to convert string into graphs and into molecular representation.

Author
Vishwesh Venkatraman
Marco Foscato

Definition at line 53 of file GraphConversionTool.java.

Member Function Documentation

◆ getGraphFromString() [1/2]

static DGraph denoptim.utils.GraphConversionTool.getGraphFromString ( String  strGraph,
boolean  useMolInfo,
FragmentSpace  fragSpace 
) throws DENOPTIMException
static

Given a formatted string-like representation of a DENOPTIM graph create the corresponding DENOPTIMGraph object.

Parameters
strGraphthe string representation in DENOPTIM format. NOTE: this is not the serialized representation of a DENOPTIMGraph, but the string obtained by the toString method the DENOPTIMGraph.
useMolInfoset to true when molecular information is available for all fragments. That is, the libraries of fragments provided to the FragmentSpace correspond to the fragments implied in the string-representation of the graph.
Returns
the Graph representation that can be used by DENOPTIM
Exceptions
denoptim.exception.DENOPTIMException
Deprecated:
this method reads the old string representation, which cannot represent all possible states of a Template. Use JSON string instead.

Definition at line 100 of file GraphConversionTool.java.

References denoptim.graph.SymmetricSet< T >.add(), denoptim.graph.EmptyVertex.addAP(), denoptim.graph.Vertex.getAP(), denoptim.graph.Vertex.getNumberOfAPs(), denoptim.graph.Vertex.getVertexId(), denoptim.graph.Vertex.newVertexFromLibrary(), denoptim.graph.Vertex.BBType.parseInt(), denoptim.graph.Edge.BondType.parseStr(), denoptim.graph.AttachmentPoint.setAPClass(), and denoptim.graph.DGraph.setGraphId().

Here is the call graph for this function:

◆ getGraphFromString() [2/2]

static DGraph denoptim.utils.GraphConversionTool.getGraphFromString ( String  strGraph,
FragmentSpace  fragSpace 
) throws DENOPTIMException
static

Given a formatted string-like representation of a DENOPTIM graph create the corresponding DENOPTIMGraph object.

This method assumes the correspondence between the graph and the loaded fragment space.

Parameters
strGraphthe string representation in DENOPTIM format. NOTE: this is not the serialized representation of a DENOPTIMGraph, but the string obtained by the toString method the DENOPTIMGraph.
Returns
the Graph representation that can be used by DENOPTIM
Exceptions
denoptim.exception.DENOPTIMException

Definition at line 72 of file GraphConversionTool.java.

References denoptim.utils.GraphConversionTool.getGraphFromString().

Referenced by denoptim.utils.GraphConversionTool.getGraphFromString(), and denoptim.io.DenoptimIO.readDENOPTIMGraphsFromTxtFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJGraphFromGraph()

static DefaultUndirectedGraph< Vertex, UndirectedEdge > denoptim.utils.GraphConversionTool.getJGraphFromGraph ( DGraph  dg)
static

Converts a DGraph into a simplified JGraphT DefaultUndirectedGraph.

The simplification consist of not producing a 1:1 list of vertexes and edges compared to the DGraph. Instead,

  • pairs of used RCVs are removed and the attachment points to which they were bound are considered to be connected by an edge.
  • all edges are considered undirected.
Parameters
dgthe graph to convert.
Returns
the simplified graph.

Definition at line 347 of file GraphConversionTool.java.

References denoptim.graph.AttachmentPoint.getBondType(), denoptim.graph.DGraph.getEdgeList(), denoptim.graph.Vertex.getEdgeToParent(), denoptim.graph.Vertex.getParent(), denoptim.graph.DGraph.getRings(), denoptim.graph.Edge.getSrcAP(), denoptim.graph.DGraph.getVertexList(), denoptim.graph.Vertex.isRCV, and denoptim.graph.DGraph.isVertexInRing().

Referenced by denoptim.graph.DGraph.isIsomorphicTo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getJGraphKernelFromGraph()

static DefaultUndirectedGraph< Node, NodeConnection > denoptim.utils.GraphConversionTool.getJGraphKernelFromGraph ( DGraph  dg)
static

Converts a DGraph into a simplified JGraphT DefaultUndirectedGraph.

The simplification is even greater than for graphs produced by
getJGraphFromGraph(DGraph) in that the content of each vertex and the identify of the attachment points are both ignored. However, in this method any free AttachmentPoint on the given graph will be converted into a node of the JGraphT, so that the location of AttachmentPoints relative to the structure of the graph can be detected.

Parameters
dgthe graph to convert.
Returns
the simplified graph.

Definition at line 409 of file GraphConversionTool.java.

References denoptim.graph.DGraph.getAvailableAPs(), denoptim.graph.DGraph.getEdgeList(), denoptim.graph.Vertex.getParent(), denoptim.graph.Vertex.getProperty(), denoptim.graph.DGraph.getRings(), denoptim.graph.DGraph.getVertexList(), denoptim.graph.Vertex.isRCV, denoptim.graph.DGraph.isVertexInRing(), and denoptim.graph.simplified.Node.REFTOVERTEXKERNEL.

Referenced by denoptim.graph.DGraph.isIsostructuralTo(), and denoptim.utils.GraphConversionToolTest.testGetJGraphKernelFromGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: