public class GraphUtil extends Object
ShortestPaths,
RingSearch| Modifier and Type | Class and Description |
|---|---|
static class |
GraphUtil.EdgeToBondMap
Utility for storing
IBonds indexed by vertex end points. |
| Modifier and Type | Method and Description |
|---|---|
static int[] |
cycle(int[][] graph,
int[] vertices)
Arrange the vertices in a simple cyclic path.
|
static int[][] |
subgraph(int[][] graph,
int[] include)
Create a subgraph by specifying the vertices from the original graph to include in the subgraph.
|
static int[][] |
toAdjList(IAtomContainer container)
Create an adjacent list representation of the container.
|
static int[][] |
toAdjList(IAtomContainer container,
GraphUtil.EdgeToBondMap bondMap)
Create an adjacent list representation of the
container and
fill in the bondMap for quick lookup. |
static int[][] |
toAdjListSubgraph(IAtomContainer container,
Set<IBond> include)
Create an adjacent list representation of the container that only
includes bonds that are in the set provided as an argument.
|
public static int[][] toAdjList(IAtomContainer container)
container - the moleculeNullPointerException - the container was nullIllegalArgumentException - a bond was found which contained atoms
not in the moleculepublic static int[][] toAdjListSubgraph(IAtomContainer container, Set<IBond> include)
container - the moleculeNullPointerException - the container was nullIllegalArgumentException - a bond was found which contained atoms
not in the moleculepublic static int[][] toAdjList(IAtomContainer container, GraphUtil.EdgeToBondMap bondMap)
container and
fill in the bondMap for quick lookup.container - the moleculebondMap - a map to index the bonds intoNullPointerException - the container was nullIllegalArgumentException - a bond was found which contained atoms
not in the moleculepublic static int[][] subgraph(int[][] graph,
int[] include)
int[][] g = toAdjList(naphthalene); int[] vs = new int[]{0, 1, 2, 3, 4, 5}; int[][] h = subgraph(g, vs); // for the vertices in h, the provided 'vs' gives the original index for(int v = 0; v < h.length; v++) { // vs[v] is 'v' in 'g' }
graph - adjacency list graphinclude - the vertices of he graph to include in the subgraphpublic static int[] cycle(int[][] graph,
int[] vertices)
IllegalArgumentException is thrown.graph - a graphvertices - set of verticesIllegalArgumentException - thrown if the vertices do not form a
cycleRingSearch.isolated()Copyright © 2022. All rights reserved.