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


Java PowerLawDistribution类代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution的典型用法代码示例。如果您正苦于以下问题:Java PowerLawDistribution类的具体用法?Java PowerLawDistribution怎么用?Java PowerLawDistribution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: afterLoadGraphWith

import org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution; //导入依赖的package包/类
@Override
protected void afterLoadGraphWith(final Graph g) throws Exception {
    ids.clear();
    final int numVertices = 10000;
    final Random r = new Random(854939487556l);
    for (int i = 0; i < numVertices; i++) {
        final Vertex v = g.addVertex("oid", i, "name", RandomStringUtils.randomAlphabetic(r.nextInt(1024)));
        ids.add(v.id());
    }

    final Distribution inDist = new PowerLawDistribution(2.3);
    final Distribution outDist = new PowerLawDistribution(2.8);
    final DistributionGenerator generator = DistributionGenerator.build(g)
            .label("knows")
            .seedGenerator(r::nextLong)
            .outDistribution(outDist)
            .inDistribution(inDist)
            .edgeProcessor(e -> e.<Double>property("weight", r.nextDouble()))
            .expectedNumEdges(numVertices * 3).create();
    edgeCount = generator.generate();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:22,代码来源:GraphReadPerformanceTest.java

示例2: shouldWriteSampleForGremlinServer

import org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution; //导入依赖的package包/类
@Test
public void shouldWriteSampleForGremlinServer() throws IOException {
    final Graph g = TinkerGraph.open();
    IntStream.range(0, 10000).forEach(i -> g.addVertex("oid", i));
    DistributionGenerator.build(g)
            .label("knows")
            .seedGenerator(() -> 987654321L)
            .outDistribution(new PowerLawDistribution(2.1))
            .inDistribution(new PowerLawDistribution(2.1))
            .expectedNumEdges(100000).create().generate();

    final OutputStream os = new FileOutputStream(tempPath + "sample.kryo");
    GryoWriter.build().mapper(GryoMapper.build().version(GryoVersion.V3_0).create()).create().writeGraph(os, g);
    os.close();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:16,代码来源:IoDataGenerationTest.java

示例3: shouldWriteSampleForGremlinServer

import org.apache.tinkerpop.gremlin.algorithm.generator.PowerLawDistribution; //导入依赖的package包/类
@Test
public void shouldWriteSampleForGremlinServer() throws IOException {
    final Graph g = TinkerGraph.open();
    IntStream.range(0, 10000).forEach(i -> g.addVertex("oid", i));
    DistributionGenerator.build(g)
            .label("knows")
            .seedGenerator(() -> 987654321l)
            .outDistribution(new PowerLawDistribution(2.1))
            .inDistribution(new PowerLawDistribution(2.1))
            .expectedNumEdges(100000).create().generate();

    final OutputStream os = new FileOutputStream(tempPath + "sample.kryo");
    GryoWriter.build().create().writeGraph(os, g);
    os.close();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:16,代码来源:IoDataGenerationTest.java


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