private UndirectedGraph dupGraph (UndirectedGraph original) { UndirectedGraph copy = new SimpleGraph (); GraphHelper.addGraph (copy, original); return copy; }
private UndirectedGraph dupGraph (UndirectedGraph original) { UndirectedGraph copy = new SimpleGraph (); GraphHelper.addGraph (copy, original); return copy; }
private UndirectedGraph dupGraph (UndirectedGraph original) { UndirectedGraph copy = new SimpleGraph (); GraphHelper.addGraph (copy, original); return copy; }
ListenableUndirectedGraph g = new ListenableUndirectedGraph (new SimpleGraph ());
ListenableUndirectedGraph g = new ListenableUndirectedGraph (new SimpleGraph ());
ListenableUndirectedGraph g = new ListenableUndirectedGraph (new SimpleGraph ());
SimpleGraph h = new SimpleGraph();
UndirectedGraph g = new SimpleGraph (); for (Iterator it = fullGraph.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next ();
UndirectedGraph g = new SimpleGraph (); for (Iterator it = fullGraph.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next ();
UndirectedGraph g = new SimpleGraph (); for (Iterator it = fullGraph.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next ();
/** * Converts a FactorGraph into a plain graph where each Variable is a vertex, * and two Variables are connected by an edge if they are arguments to the same factor. * (Essentially converts an fg into an MRF structure, minus the factors.) * @param fg * @return a Graph */ public static UndirectedGraph mdlToGraph (FactorGraph fg) { UndirectedGraph g = new SimpleGraph (); for (Iterator it = fg.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next (); g.addVertex (var); } for (Iterator it = fg.factorsIterator (); it.hasNext ();) { Factor factor = (Factor) it.next (); VarSet varSet = factor.varSet (); int nv = varSet.size (); for (int i = 0; i < nv; i++) { for (int j = i + 1; j < nv; j++) { g.addEdge (varSet.get (i), varSet.get (j)); } } } return g; }
/** * Converts a FactorGraph into a plain graph where each Variable is a vertex, * and two Variables are connected by an edge if they are arguments to the same factor. * (Essentially converts an fg into an MRF structure, minus the factors.) * @param fg * @return a Graph */ public static UndirectedGraph mdlToGraph (FactorGraph fg) { UndirectedGraph g = new SimpleGraph (); for (Iterator it = fg.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next (); g.addVertex (var); } for (Iterator it = fg.factorsIterator (); it.hasNext ();) { Factor factor = (Factor) it.next (); VarSet varSet = factor.varSet (); int nv = varSet.size (); for (int i = 0; i < nv; i++) { for (int j = i + 1; j < nv; j++) { g.addEdge (varSet.get (i), varSet.get (j)); } } } return g; }
/** * Converts a FactorGraph into a plain graph where each Variable is a vertex, * and two Variables are connected by an edge if they are arguments to the same factor. * (Essentially converts an fg into an MRF structure, minus the factors.) * @param fg * @return a Graph */ public static UndirectedGraph mdlToGraph (FactorGraph fg) { UndirectedGraph g = new SimpleGraph (); for (Iterator it = fg.variablesIterator (); it.hasNext ();) { Variable var = (Variable) it.next (); g.addVertex (var); } for (Iterator it = fg.factorsIterator (); it.hasNext ();) { Factor factor = (Factor) it.next (); VarSet varSet = factor.varSet (); int nv = varSet.size (); for (int i = 0; i < nv; i++) { for (int j = i + 1; j < nv; j++) { g.addEdge (varSet.get (i), varSet.get (j)); } } } return g; }
UndirectedGraph h = new SimpleGraph(); h.addAllVertices(cycles);
/** * Creates a molecule graph for use with jgrapht. * Bond orders are not respected. * * @param molecule the specified molecule * @return a graph representing the molecule */ 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); /* * int order = (int) bond.getOrder(); for (int j=0; j<order; j++) { * graph.addEdge(bond.getAtoms()[0], bond.getAtoms()[1]); } */ graph.addEdge(bond.getBegin(), bond.getEnd()); } return graph; }