blob: 6a027ac8cce0d6b835e3b49eb81540e87a0460f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package Chapter4.centrality.examples;
import Chapter4.util.TweetFileToGraph;
import java.io.File;
import GraphElements.RetweetEdge;
import GraphElements.UserNode;
import edu.uci.ics.jung.graph.DirectedGraph;
public class InDegreeCentralityExample {
public static void main(String[] args){
File tweetFile;
if(args.length > 0){
tweetFile = new File(args[0]);
}
else{
tweetFile = new File("synthetic_retweet_network.json");
}
DirectedGraph<UserNode, RetweetEdge> retweetGraph = TweetFileToGraph.getRetweetNetwork(tweetFile);
//calculate the betweenness centrality
for(UserNode node : retweetGraph.getVertices()){
System.out.println(node + " - " + retweetGraph.getInEdges(node).size());
}
}
}
|