blob: 0da987e80712bac584d0940eb0edd56a9971f9f7 [file] [log] [blame]
Yuta HIGUCHIa1e655a2014-01-23 17:43:11 -08001/* Copyright (c) 2013 Stanford University
2 *
3 * Permission to use, copy, modify, and distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 */
15
yoshi28bac132014-01-22 11:00:17 -080016package com.tinkerpop.blueprints.impls.ramcloud;
17
18import java.util.logging.Level;
19
20import com.tinkerpop.blueprints.Graph;
21import com.tinkerpop.furnace.generators.CommunityGenerator;
22import com.tinkerpop.furnace.generators.DistributionGenerator;
23import com.tinkerpop.furnace.generators.NormalDistribution;
24
25public class FurnaceExamples {
26
27 public FurnaceExamples() {
28 // TODO Auto-generated constructor stub
29 }
30
31 public static int generateCommunityGraph(Graph graph, String label) {
32 CommunityGenerator cg = new CommunityGenerator(label);
33 int numEdges;
34
35 for(int i = 0; i<30; i++) {
36 graph.addVertex(null);
37 }
38
39 cg.setCommunityDistribution(new NormalDistribution(2.0));
40 cg.setDegreeDistribution(new NormalDistribution(2.0));
41 numEdges = cg.generate(graph, 3, 60);
42
43 return numEdges;
44 }
45
46 public static int generateDistributionGraph(Graph graph, String label) {
47 DistributionGenerator dg = new DistributionGenerator(label);
48 int numEdges;
49
50 for(int i = 0; i<10; i++) {
51 graph.addVertex(null);
52 }
53
54 dg.setAllowLoops(true);
55 dg.setInDistribution(new NormalDistribution(2.0));
56 dg.setOutDistribution(new NormalDistribution(2.0));
57 numEdges = dg.generate(graph, 20);
58
59 return numEdges;
60 }
61
62 public static void main(String[] args) {
63 Graph graph = new RamCloudGraph(Level.FINER);
64
65 //generateCommunityGraph(graph, "HippieCommune");
66
67 //generateDistributionGraph(graph, "HippieRefuge");
68
69 graph.shutdown();
70 }
71
72}