protected KeyedGraph < V , E > prepareGraph ( ) throws SQLException { LOGGER . info ( "Loading graph into memory..." ) ; final long start = System . currentTimeMillis ( ) ; // Initialize the graph. KeyedGraph < V , E > graph ; if ( ! globalOrientation . equals ( GraphFunctionParser . Orientation . UNDIRECTED ) ) { if ( weightColumn != null ) { graph = new DirectedWeightedPseudoG < V , E > ( vertexClass , edgeClass ) ; } else { graph = new DirectedPseudoG < V , E > ( vertexClass , edgeClass ) ; } } else { if ( weightColumn != null ) { graph = new WeightedPseudoG < V , E > ( vertexClass , edgeClass ) ; } else { graph = new PseudoG < V , E > ( vertexClass , edgeClass ) ; } } final Statement st = connection . createStatement ( ) ; final ResultSet edges = st . executeQuery ( "SELECT * FROM " + TableUtilities . parseInputTable ( connection , inputTable ) ) ; // Initialize the indices. initIndices ( edges ) ; try { // Add the edges. while ( edges . next ( ) ) { loadEdge ( graph , edges ) ; } logTime ( LOGGER , start ) ; return graph ; } catch ( SQLException e ) { LOGGER . error ( "Could not store edges in graph." , e ) ; return null ; } finally { edges . close ( ) ; st . close ( ) ; } }
Prepares a graph .