MoleculeGraphs { static public SimpleGraph getMoleculeGraph(IAtomContainer molecule) { SimpleGraph graph = new SimpleGraph(); for (int i = 0; i < molecule.getAtomCount(); i++) { IAtom atom = molecule.getAtom(i); graph.addVertex(atom); } for (int i = 0; i < molecule.getBondCount(); i++) { IBond bond = molecule.getBond(i); graph.addEdge(bond.getBegin(), bond.getEnd()); } return graph; } private  MoleculeGraphs(); static SimpleGraph getMoleculeGraph(IAtomContainer molecule);  }
@Test public void testGetMoleculeGraph_IAtomContainer() { IAtomContainer apinene = TestMoleculeFactory.makeAlphaPinene(); SimpleGraph graph = MoleculeGraphs.getMoleculeGraph(apinene); Assert.assertEquals(apinene.getAtomCount(), graph.vertexSet().size()); Assert.assertEquals(apinene.getBondCount(), graph.edgeSet().size()); }