GraphStream Users

Archives de la liste Aide


Re: Displaying community scores of nodes


Chronologique Discussions 
  • From: Suhas Bhairav <suhasbhairav AT gmail.com>
  • To: graphstream-users AT litislab.fr
  • Subject: Re: Displaying community scores of nodes
  • Date: Fri, 5 Aug 2016 14:02:49 +0200

Hi,

I think I found a way to do this. Is this the right way to display community score of each node?

package main.graph.ui;

import java.util.Iterator;

import org.graphstream.algorithm.community.DecentralizedCommunityAlgorithm;
import org.graphstream.algorithm.community.EpidemicCommunityAlgorithm;
import org.graphstream.algorithm.generator.BarabasiAlbertGenerator;
import org.graphstream.algorithm.generator.Generator;
import org.graphstream.graph.Graph;
import org.graphstream.graph.Node;
import org.graphstream.graph.implementations.SingleGraph;

public class TestCommunity {
   
    public static void main(String[] args){
        Graph graph = new SingleGraph("Barabàsi-Albert");
        Generator gen = new BarabasiAlbertGenerator(1);
        gen.addSink(graph);
        gen.begin();

        for(int i=0; i<100; i++) {
            gen.nextEvents();
        }

        gen.end();
        DecentralizedCommunityAlgorithm community = new EpidemicCommunityAlgorithm(graph, null);
        community.compute();
        for(Node node:graph){
           node.setAttribute("ui.style", "fill-color:green;");
            node.setAttribute("ui.label", "Node:"+node.getId()+" -- Score:"+node.getAttribute(community.getMarker()));
        }
        graph.display();
       
       
    }

}


Regards
Suhas Bhairav

On 5 August 2016 at 13:00, Suhas Bhairav <suhasbhairav AT gmail.com> wrote:
Hi,

Can someone please let me know as to how we can extract the community score of each node in a graph using community detection algorithm like EpidemicCommunityAlgorithm? I'm somehow not able to do so. After computing the community scores on the graph, I'm not sure on how to proceed.


Regards
Suhas Bhairav




Archives gérées par MHonArc 2.6.16.

Top of page