GraphStream Users

Archives de la liste Aide


Re: BetweenessCentrality for directed graphs


Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, schoellhorn AT ifm.uni-mannheim.de
  • Subject: Re: BetweenessCentrality for directed graphs
  • Date: Tue, 9 Feb 2016 11:40:53 +0100

Hi Tino,

It seems there is a problem with SingleGraph. The getEdgeBetween method of SingleNode has a strange behavior. We are looking to fix it.
You can use AdjacencyListGraph, it should work with it.

Thanks for reporting this.
Cheers.

2016-02-09 9:29 GMT+01:00 <schoellhorn AT ifm.uni-mannheim.de>:
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"));



--
Guilhelm Savin
PhD of Computer Science



Archives gérées par MHonArc 2.6.16.

Top of page