GermaNetLexUnitSenseInventory extends SenseInventoryBase implements SenseDictionary, SenseTaxonomy { @Override public UndirectedGraph<String, UnorderedPair<String>> getUndirectedGraph() throws SenseInventoryException, UnsupportedOperationException { if (undirectedGnetGraph != null) { return undirectedGnetGraph; } logger.info("Creating sense graph for " + gnet.numLexUnits() + " lexical units..."); int lexUnitCount = 0; undirectedGnetGraph = new UndirectedSparseGraph<String, UnorderedPair<String>>(); String sourceLexUnitId, targetLexUnitId; for (LexUnit sourceLexUnit : gnet.getLexUnits()) { if (++lexUnitCount % 1000 == 0) { logger.debug("Processed " + lexUnitCount + " lexical units..."); } sourceLexUnitId = Integer.toString(sourceLexUnit.getId()); Set<LexUnit> targetLexUnits = new HashSet<LexUnit>( sourceLexUnit.getRelatedLexUnits()); targetLexUnits.addAll(sourceLexUnit.getSynset().getLexUnits()); for (Synset synset : sourceLexUnit.getSynset().getRelatedSynsets()) { targetLexUnits.addAll(synset.getLexUnits()); } for (LexUnit targetLexUnit : targetLexUnits) { targetLexUnitId = Integer.toString(targetLexUnit.getId()); UnorderedPair<String> e = new UnorderedPair<String>( sourceLexUnitId, targetLexUnitId); if (!undirectedGnetGraph.containsEdge(e)) { undirectedGnetGraph.addEdge(e, sourceLexUnitId, targetLexUnitId); } } } logger.info("# vertices = " + undirectedGnetGraph.getVertexCount() + "; # edges = " + undirectedGnetGraph.getEdgeCount()); undirectedGnetGraph = Graphs .unmodifiableUndirectedGraph(undirectedGnetGraph); return undirectedGnetGraph; } GermaNetLexUnitSenseInventory(String gnetDirectory); GermaNet getUnderlyingResource(); @Override Map<String, List<String>> getSenseInventory(); @Override List<String> getSenses(String sod); @Override List<String> getSenses(String sod, POS pos); @Override String getMostFrequentSense(String sod); @Override String getMostFrequentSense(String sod, POS pos); @Override String getSenseDescription(String senseId); @Override String getSenseInventoryName(); @Override UndirectedGraph<String, UnorderedPair<String>> getUndirectedGraph(); @Override void setUndirectedGraph(
            UndirectedGraph<String, UnorderedPair<String>> graph); @Override Set<String> getSenseNeighbours(String senseId); @Override Set<String> getSenseExamples(String senseId); @Override Set<String> getSenseWords(String senseId); @Override String getSenseDefinition(String senseId); @Override POS getPos(String senseId); void setSenseDescriptionFormat(String format); @Override int getUseCount(String senseId);  }
@Ignore @Test public void testGraph() throws SenseInventoryException, UnsupportedOperationException { Graph<String, UnorderedPair<String>> g = si.getUndirectedGraph(); System.out.println("Graph has " + g.getVertexCount() + " vertices and " + g.getEdgeCount() + " edges"); }