GraphStream Users

Archives de la liste Aide


Re: BetweenessCentrality for directed graphs


Chronologique Discussions 
  • From: Tino Schöllhorn <schoellhorn AT ifm.uni-mannheim.de>
  • To: guilhelm savin <guilhelm.savin AT gmail.com>, "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>
  • Subject: Re: BetweenessCentrality for directed graphs
  • Date: Wed, 10 Feb 2016 08:55:46 +0100

Hi,

this seems to work. Thank you.

Tino

Am 09.02.2016 um 11:40 schrieb guilhelm savin:
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


-- 
Tino Schöllhorn
Diplom-Wirtschaftsinformatiker

ifm
Institut für Mittelstandsforschung
Lehrstuhl für Mittelstandsforschung und Entrepreneurship
L 9, 1-2
68161 Mannheim

Tel: +49-621-181-3532
Fax: +49-621-181-2892
e-mail: schoellhorn AT ifm.uni-mannheim.de
internet: http://www.ifm.uni-mannheim.de 



Archives gérées par MHonArc 2.6.16.

Top of page