当前位置: 首页>>代码示例>>Java>>正文


Java BinIO.storeInts方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.io.BinIO.storeInts方法的典型用法代码示例。如果您正苦于以下问题:Java BinIO.storeInts方法的具体用法?Java BinIO.storeInts怎么用?Java BinIO.storeInts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.io.BinIO的用法示例。


在下文中一共展示了BinIO.storeInts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
/** Saves this immutable subgraph with a given basename. 
 * 
 * <P>Note that this method will <strong>not</strong> save the
 * supergraph, but only the subgraph files, that is, the subgraph property file
 * (with extension <samp>.properties</samp>) and the file containing
 * the subgraph nodes (with extension <samp>.nodes</samp>). A reference
 * to the supergraph basename will be stored in the property file.
 * 
 * @param basename the basename to be used to save the subgraph.
 * @param pl a progress logger, or <code>null</code>.
 */
public void save( final CharSequence basename, final ProgressLogger pl ) throws IOException {

	final Properties properties = new Properties();
	properties.setProperty( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY, ImmutableSubgraph.class.getName() );
	properties.setProperty( SUPERGRAPHBASENAME_PROPERTY_KEY, supergraph.basename().toString() );

	final FileOutputStream propertyFile = new FileOutputStream( basename + PROPERTIES_EXTENSION );
	properties.store( propertyFile, null );
	propertyFile.close();
	
	// Save the subgraph nodes
	if ( pl != null ) pl.start( "Saving nodes..." );
	BinIO.storeInts( subgraphNode, 0, subgraphNode.length, basename + ".nodes" );
	
	if ( pl != null ) {
		pl.count = subgraphNode.length;
		pl.done();
	}
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:31,代码来源:ImmutableSubgraph.java

示例2: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException {
	SimpleJSAP jsap = new SimpleJSAP( ConnectedComponents.class.getName(),
			"Computes the connected components of a symmetric graph of given basename. The resulting data is saved " +
			"in files stemmed from the given basename with extension .wcc (a list of binary integers specifying the " +
			"component of each node) and .wccsizes (a list of binary integer specifying the size of each component). " +
			"The symmetric graph can also be specified using a generic (non-symmetric) graph and its transpose.",
			new Parameter[] {
				new Switch( "sizes", 's', "sizes", "Compute component sizes." ),
				new Switch( "renumber", 'r', "renumber", "Renumber components in decreasing-size order." ),
				new FlaggedOption( "logInterval", JSAP.LONG_PARSER, Long.toString( ProgressLogger.DEFAULT_LOG_INTERVAL ), JSAP.NOT_REQUIRED, 'l', "log-interval", "The minimum time interval between activity logs in milliseconds." ), 
				new Switch( "mapped", 'm', "mapped", "Do not load the graph in main memory, but rather memory-map it." ),
				new FlaggedOption( "threads", JSAP.INTSIZE_PARSER, "0", JSAP.NOT_REQUIRED, 'T', "threads", "The number of threads to be used. If 0, the number will be estimated automatically." ),
				new FlaggedOption( "basenamet", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 't', "transpose", "The basename of the transpose, in case the graph is not symmetric." ),
				new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of a symmetric graph (or of a generic graph, if the transpose is provided, too)." ),
				new UnflaggedOption( "resultsBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The basename of the resulting files." ),
			}
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final String basename = jsapResult.getString( "basename" );
	final String basenamet = jsapResult.getString( "basenamet" );
	final String resultsBasename = jsapResult.getString( "resultsBasename", basename );
	final int threads = jsapResult.getInt( "threads" );
	ProgressLogger pl = new ProgressLogger( LOGGER, jsapResult.getLong( "logInterval" ), TimeUnit.MILLISECONDS );

	ImmutableGraph graph = jsapResult.userSpecified( "mapped" ) ? ImmutableGraph.loadMapped( basename ) : ImmutableGraph.load( basename, pl );
	ImmutableGraph grapht = basenamet == null ? null : jsapResult.userSpecified( "mapped" ) ? ImmutableGraph.loadMapped( basenamet ) : ImmutableGraph.load( basenamet, pl );
	final ConnectedComponents components = ConnectedComponents.compute( basenamet != null ? new UnionImmutableGraph( graph, grapht ) : graph, threads, pl );

	if ( jsapResult.getBoolean( "sizes" ) || jsapResult.getBoolean( "renumber" ) ) {
		final int size[] = components.computeSizes();
		if ( jsapResult.getBoolean( "renumber" ) ) components.sortBySize( size );
		if ( jsapResult.getBoolean( "sizes" ) ) BinIO.storeInts( size, resultsBasename + ".wccsizes" );
	}
	BinIO.storeInts( components.component, resultsBasename + ".wcc" );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:39,代码来源:ConnectedComponents.java

示例3: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException {
	SimpleJSAP jsap = new SimpleJSAP( StronglyConnectedComponents.class.getName(), 
			"Computes the strongly connected components (and optionally the buckets) of a graph of given basename. The resulting data is saved " +
			"in files stemmed from the given basename with extension .scc (a list of binary integers specifying the " +
			"component of each node), .sccsizes (a list of binary integer specifying the size of each component) and .buckets " +
			" (a serialised LongArrayBigVector specifying buckets). Please use suitable JVM options to set a large stack size.",
			new Parameter[] {
		new Switch( "sizes", 's', "sizes", "Compute component sizes." ),
		new Switch( "renumber", 'r', "renumber", "Renumber components in decreasing-size order." ),
		new Switch( "buckets", 'b', "buckets", "Compute buckets (nodes belonging to a bucket component, i.e., a terminal nondangling component)." ),
		new FlaggedOption( "filter", new ObjectParser( LabelledArcFilter.class, GraphClassParser.PACKAGE ), JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'f', "filter", "A filter for labelled arcs; requires the provided graph to be arc labelled." ),
		new FlaggedOption( "logInterval", JSAP.LONG_PARSER, Long.toString( ProgressLogger.DEFAULT_LOG_INTERVAL ), JSAP.NOT_REQUIRED, 'l', "log-interval", "The minimum time interval between activity logs in milliseconds." ),
		new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
		new UnflaggedOption( "resultsBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The basename of the resulting files." ),
	}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final String basename = jsapResult.getString( "basename" );
	final String resultsBasename = jsapResult.getString( "resultsBasename", basename );
	final LabelledArcFilter filter = (LabelledArcFilter)jsapResult.getObject( "filter" );
	ProgressLogger pl = new ProgressLogger( LOGGER, jsapResult.getLong( "logInterval" ), TimeUnit.MILLISECONDS );

	final StronglyConnectedComponents components = 
		filter != null ? StronglyConnectedComponents.compute( ArcLabelledImmutableGraph.load( basename ), filter, jsapResult.getBoolean( "buckets" ), pl )
				: StronglyConnectedComponents.compute( ImmutableGraph.load( basename ), jsapResult.getBoolean( "buckets" ), pl );

	if ( jsapResult.getBoolean( "sizes" ) || jsapResult.getBoolean( "renumber" ) ) {
		final int size[] = components.computeSizes();
		if ( jsapResult.getBoolean( "renumber" ) ) components.sortBySize( size );
		if ( jsapResult.getBoolean( "sizes" ) ) BinIO.storeInts( size, resultsBasename + ".sccsizes" );
	}
	BinIO.storeInts(  components.component, resultsBasename + ".scc" );
	if ( components.buckets != null ) BinIO.storeObject( components.buckets, resultsBasename + ".buckets" );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:38,代码来源:StronglyConnectedComponents.java


注:本文中的it.unimi.dsi.fastutil.io.BinIO.storeInts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。