本文整理汇总了Java中science.atlarge.graphalytics.domain.algorithms.PageRankParameters类的典型用法代码示例。如果您正苦于以下问题:Java PageRankParameters类的具体用法?Java PageRankParameters怎么用?Java PageRankParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PageRankParameters类属于science.atlarge.graphalytics.domain.algorithms包,在下文中一共展示了PageRankParameters类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
private PageRankOutput execute(GraphStructure graph, PageRankParameters parameters, boolean directed)
throws Exception {
File edgesFile = File.createTempFile("edges.", ".txt");
File verticesFile = File.createTempFile("vertices.", ".txt");
File outputFile = File.createTempFile("output.", ".txt");
Utils.writeEdgeToFile(graph, directed, edgesFile);
Utils.writeVerticesToFile(graph, verticesFile);
String jobId = "RandomJobId";
String logPath = "RandomLogDir";
PageRankJob job = new PageRankJob(
Utils.loadConfiguration(),
verticesFile.getAbsolutePath(), edgesFile.getAbsolutePath(),
directed, parameters, jobId, logPath);
job.setOutputFile(outputFile);
job.run();
return new PageRankOutput(Utils.readResults(outputFile, Double.class));
}
示例2: testDirectedPageRankOnValidationGraph
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
@Test
public final void testDirectedPageRankOnValidationGraph() throws Exception {
final String inputPath = "/validation-graphs/pr/dir-input";
final String outputPath = "/validation-graphs/pr/dir-output";
final float dampingFactor = 0.85f;
final int numberOfIterations = 14;
GraphStructure inputGraph = GraphParser.parseGraphStructureFromVertexBasedDataset(
getClass().getResourceAsStream(inputPath), true);
PageRankParameters parameters = new PageRankParameters(dampingFactor, numberOfIterations);
PageRankOutput executionResult = executeDirectedPageRank(inputGraph, parameters);
validatePageRank(executionResult, outputPath);
}
示例3: testUndirectedPageRankOnValidationGraph
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
@Test
public final void testUndirectedPageRankOnValidationGraph() throws Exception {
final String inputPath = "/validation-graphs/pr/undir-input";
final String outputPath = "/validation-graphs/pr/undir-output";
final float dampingFactor = 0.85f;
final int numberOfIterations = 26;
GraphStructure inputGraph = GraphParser.parseGraphStructureFromVertexBasedDataset(
getClass().getResourceAsStream(inputPath), true);
PageRankParameters parameters = new PageRankParameters(dampingFactor, numberOfIterations);
PageRankOutput executionResult = executeUndirectedPageRank(inputGraph, parameters);
validatePageRank(executionResult, outputPath);
}
示例4: run
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
@Override
public void run(RunSpecification runSpecification) throws PlatformExecutionException {
BenchmarkRun benchmarkRun = runSpecification.getBenchmarkRun();
BenchmarkRunSetup benchmarkRunSetup = runSpecification.getBenchmarkRunSetup();
RuntimeSetup runtimeSetup = runSpecification.getRuntimeSetup();
PowergraphJob job;
Object params = benchmarkRun.getAlgorithmParameters();
String logPath = benchmarkRunSetup.getLogDir().resolve("platform").toString();
boolean graphDirected = benchmarkRun.getFormattedGraph().isDirected();
String vertexFilePath = runtimeSetup.getLoadedGraph().getVertexPath();
String edgeFilePath = runtimeSetup.getLoadedGraph().getEdgePath();
switch(benchmarkRun.getAlgorithm()) {
case BFS:
job = new BreadthFirstSearchJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (BreadthFirstSearchParameters) params, benchmarkRun.getId(), logPath);
break;
case WCC:
job = new ConnectedComponentsJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, benchmarkRun.getId(), logPath);
break;
case LCC:
job = new LocalClusteringCoefficientJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, benchmarkRun.getId(), logPath);
break;
case CDLP:
job = new CommunityDetectionJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (CommunityDetectionLPParameters) params, benchmarkRun.getId(), logPath);
break;
case PR:
job = new PageRankJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (PageRankParameters) params, benchmarkRun.getId(), logPath);
break;
case SSSP:
job = new SingleSourceShortestPathsJob(benchmarkConfig, vertexFilePath, edgeFilePath,
graphDirected, (SingleSourceShortestPathsParameters) params, benchmarkRun.getId(), logPath);
break;
default:
throw new PlatformExecutionException("Unsupported algorithm");
}
if (benchmarkRunSetup.isOutputRequired()) {
Path outputFile = benchmarkRunSetup.getOutputDir().resolve(benchmarkRun.getName());
job.setOutputFile(outputFile.toFile());
}
try {
job.run();
} catch (IOException|InterruptedException e) {
throw new PlatformExecutionException("failed to execute command", e);
}
}
示例5: PageRankJob
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
public PageRankJob(Configuration config, String verticesPath, String edgesPath,
boolean graphDirected, PageRankParameters params, String jobId, String logPath) {
super(config, verticesPath, edgesPath, graphDirected, jobId, logPath);
this.params = params;
}
示例6: executeDirectedPageRank
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
@Override
public PageRankOutput executeDirectedPageRank(GraphStructure graph, PageRankParameters parameters)
throws Exception {
return execute(graph, parameters, true);
}
示例7: executeUndirectedPageRank
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
@Override
public PageRankOutput executeUndirectedPageRank(GraphStructure graph, PageRankParameters parameters)
throws Exception {
return execute(graph, parameters, false);
}
示例8: executeDirectedPageRank
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
/**
* Executes the platform-specific implementation of the PageRank algorithm on an in-memory directed graph with given
* parameters, and returns the output of the execution.
* <p/>
* This function is called with sample graphs and the output is compared with known-correct results.
*
* @param graph the graph to execute the PageRank algorithm on
* @param parameters the values for the algorithm parameters to use
* @return the output of the PageRank algorithm
* @throws Exception
*/
public abstract PageRankOutput executeDirectedPageRank(GraphStructure graph, PageRankParameters parameters)
throws Exception;
示例9: executeUndirectedPageRank
import science.atlarge.graphalytics.domain.algorithms.PageRankParameters; //导入依赖的package包/类
/**
* Executes the platform-specific implementation of the PageRank algorithm on an in-memory undirected graph with
* given parameters, and returns the output of the execution.
* <p/>
* This function is called with sample graphs and the output is compared with known-correct results.
*
* @param graph the graph to execute the PageRank algorithm on
* @param parameters the values for the algorithm parameters to use
* @return the output of the PageRank algorithm
* @throws Exception
*/
public abstract PageRankOutput executeUndirectedPageRank(GraphStructure graph, PageRankParameters parameters)
throws Exception;