Created
August 11, 2016 08:33
-
-
Save pigne/e81075590fd5a5b43a00d3c663a8a236 to your computer and use it in GitHub Desktop.
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
import org.graphstream.algorithm.generator.BarabasiAlbertGenerator; | |
import org.graphstream.algorithm.generator.Generator; | |
import org.graphstream.stream.Sink; | |
import org.graphstream.stream.SinkAdapter; | |
/** | |
* Created by pigne on 8/11/16. | |
*/ | |
public class PrintEdgeEvents { | |
public static void main(String[] args) { | |
int maxEdgePerEvent = 5; | |
int numberOfNodes = 10; | |
Generator generator = new BarabasiAlbertGenerator(maxEdgePerEvent); | |
Sink s = new SinkAdapter(){ | |
@Override | |
public void edgeAdded(String sourceId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed) { | |
System.out.printf("Edge %s added from node %s to node %s%n", edgeId,fromNodeId, toNodeId); | |
} | |
}; | |
generator.addSink(s); | |
generator.begin(); | |
for (int i = 0; i < numberOfNodes; i++) { | |
generator.nextEvents(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment