GraphStream Users

Archives de la liste Aide


BetweenessCentrality for directed graphs


Chronologique Discussions 
  • From: <schoellhorn AT ifm.uni-mannheim.de>
  • To: graphstream-users AT litislab.fr
  • Subject: BetweenessCentrality for directed graphs
  • Date: Tue, 9 Feb 2016 09:29:04 +0100 (CET)

Hi,

I'd like to compute the BetweenessCentrality for a directed Graph. But when
changing the example on
http://graphstream-project.org/doc/Algorithms/Betweenness-Centrality/ to a
directed graph the algorithm stop. with a NullpointerException.

As far as I am aware the BC can be computed for directed Graphs as well. Is it
possible with GraphStream? Do you have any proposals how to achieve that?



Tino

P.S: Example-Code:

Graph graph = new SingleGraph("Betweenness Test");

Node A = graph.addNode("A");
Node B = graph.addNode("B");
Node E = graph.addNode("E");
Node C = graph.addNode("C");
Node D = graph.addNode("D");

graph.addEdge("AB", "A", "B", true);
graph.addEdge("BE", "B", "E", true);
graph.addEdge("BC", "B", "C", true);
graph.addEdge("ED", "E", "D", true);
graph.addEdge("CD", "C", "D", true);
graph.addEdge("AE", "A", "E", true);

BetweennessCentrality bcb = new BetweennessCentrality();
bcb.setWeightAttributeName("weight");
bcb.setWeight(A, B, 1);
bcb.setWeight(B, E, 6);
bcb.setWeight(B, C, 5);
bcb.setWeight(E, D, 2);
bcb.setWeight(C, D, 3);
bcb.setWeight(A, E, 4);
bcb.init(graph);
bcb.compute();

System.out.println("A="+ A.getAttribute("Cb"));
System.out.println("B="+ B.getAttribute("Cb"));
System.out.println("C="+ C.getAttribute("Cb"));
System.out.println("D="+ D.getAttribute("Cb"));
System.out.println("E="+ E.getAttribute("Cb"));



Archives gérées par MHonArc 2.6.16.

Top of page