@Test public void benzeneMixed() throws Exception { Graph g = Parser.parse("C:1:C:C:C:C:C1"); Assert.assertThat(Generator.generate(g), CoreMatchers.is("C:1:C:C:C:C:C1")); Assert.assertThat(Generator.generate(f.apply(g)), CoreMatchers.is("C:1:C:C:C:C:C1")); }
public Graph apply(final Graph g) { Graph h = new Graph(g.order()); for (int u = 0; u < g.order(); u++) { h.addAtom(g.atom(u)); h.addTopology(g.topologyOf(u)); } for (int u = 0; u < g.order(); u++) { for (final Edge e : g.edges(u)) { if (e.other(u) > u) h.addEdge(toImplicitEdge(g, e)); } } return h; }
ExplicitToImplicit extends AbstractFunction<Graph, Graph> { public Graph apply(final Graph g) { Graph h = new Graph(g.order()); for (int u = 0; u < g.order(); u++) { h.addAtom(g.atom(u)); h.addTopology(g.topologyOf(u)); } for (int u = 0; u < g.order(); u++) { for (final Edge e : g.edges(u)) { if (e.other(u) > u) h.addEdge(toImplicitEdge(g, e)); } } return h; } }
ExplicitToImplicit extends AbstractFunction<Graph, Graph> { public Graph apply(final Graph g) { Graph h = new Graph(g.order()); for (int u = 0; u < g.order(); u++) { h.addAtom(g.atom(u)); h.addTopology(g.topologyOf(u)); } for (int u = 0; u < g.order(); u++) { for (final Edge e : g.edges(u)) { if (e.other(u) > u) h.addEdge(toImplicitEdge(g, e)); } } return h; }  }
ExplicitToImplicit extends AbstractFunction<Graph, Graph> { public Graph apply(final Graph g) { Graph h = new Graph(g.order()); for (int u = 0; u < g.order(); u++) { h.addAtom(g.atom(u)); h.addTopology(g.topologyOf(u)); } for (int u = 0; u < g.order(); u++) { for (final Edge e : g.edges(u)) { if (e.other(u) > u) h.addEdge(toImplicitEdge(g, e)); } } return h; }  Graph apply(final Graph g); }
ExplicitToImplicit extends AbstractFunction<Graph, Graph> { public Graph apply(final Graph g) { Graph h = new Graph(g.order()); for (int u = 0; u < g.order(); u++) { h.addAtom(g.atom(u)); h.addTopology(g.topologyOf(u)); } for (int u = 0; u < g.order(); u++) { for (final Edge e : g.edges(u)) { if (e.other(u) > u) h.addEdge(toImplicitEdge(g, e)); } } return h; }  Graph apply(final Graph g);  }