Created
January 15, 2013 11:45
-
-
Save xhochy/4538077 to your computer and use it in GitHub Desktop.
Generate graph communities and annotate vertices so that each vertex has its community as a property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xhochy | |
import com.tinkerpop.blueprints.impls.tg.TinkerGraph | |
import com.tinkerpop.furnace.generators.{ CommunityGenerator, EdgeAnnotator, NormalDistribution, PowerLawDistribution, VertexAnnotator } | |
object Generator { | |
def main(args: Array[String]) = { | |
val graph = new TinkerGraph | |
Range(0, 100).foreach(graph.addVertex(_)) | |
val generator = new CommunityGenerator("edge", EdgeAnnotator.NONE, VertexAnnotator.COPY_CONTEXT) | |
generator.setCommunityDistribution(new NormalDistribution(3)); | |
generator.setDegreeDistribution(new PowerLawDistribution(2.3)); | |
generator.setCrossCommunityPercentage(0.1); | |
val numEdges = generator.generate(graph, 10, 1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment