diff options
Diffstat (limited to 'src/Chapter4/centrality/examples/InDegreeCentralityExample.java')
-rw-r--r-- | src/Chapter4/centrality/examples/InDegreeCentralityExample.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Chapter4/centrality/examples/InDegreeCentralityExample.java b/src/Chapter4/centrality/examples/InDegreeCentralityExample.java new file mode 100644 index 0000000..6a027ac --- /dev/null +++ b/src/Chapter4/centrality/examples/InDegreeCentralityExample.java @@ -0,0 +1,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()); + } + + } +} |