GraphStream Users

Archives de la liste Aide


Re: Displaying large graphs


Chronologique Discussions 
  • From: Stefan Balev <stefan.balev AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, Cherie Pun <cherie.cy.pun AT gmail.com>
  • Subject: Re: Displaying large graphs
  • Date: Wed, 13 Apr 2016 11:35:10 +0200

Hi,

My best guess is that you are reaching some limits: of your hardware, of Java2D or of the layout algorithm. When you see a single dot the layout runs, but it just takes too long. There are several things you can try without warranty of success.
 - Activate Java2D hardware acceleration.
 - Simplify your stylesheets as much as possible, the best will be no styling at all, but at least avoid dynamic colors. Btw, why you assign "ui.class" attribute twice?
 - Be patient. Run your application in the evening, if you are lucky you will see something the next morning.

If you are impatient and want to see some action, try to display the graph before the loop. In the loop, add something like

int edges = 0;
for (...) {
    ....
    if (strength > 0) {
        ....
        edges++;
    }
    if (edges % a == 0) Thread.sleep(b);
}

Adjust a and b for best results.

However, sorry to repeat myself, but I keep thinking that displaying directly graphs of this size is pointless, all you will see is probably a big messy ball.

Cheers,

--
Stefan



2016-04-12 17:19 GMT+02:00 Cherie Pun <cherie.cy.pun AT gmail.com>:
Hi,

I am trying to display a graph with 457555 edges but it shows up as a single dot on my computer. If I limit to 5000 edges, it shows a graph as attached below. Is there a reason why it's doing this? I am using a hashmap to store the edges and the following code to construct the graph. Thank you very much for your help.
Inline images 1

Inline images 2
private static void displayGraph(HashMap<UserPair, TrustRelation> map) {
Graph graph = new SingleGraph("Trust");
graph.setStrict(false);
graph.setAutoCreate( true );
graph.addAttribute("ui.stylesheet", STYLE_SHEET);
for(Map.Entry<UserPair, TrustRelation> entry : map.entrySet()){
UserPair up = entry.getKey();
TrustRelation tr = entry.getValue();
double strengthOfTrust = tr.computeConversationalTrust();
if (strengthOfTrust > 0) {
Edge edge = graph.addEdge(up.toString(), Integer.toString(up.getUserA()), Integer.toString(up.getUserB()));
edge.addAttribute("weight", strengthOfTrust);
edge.addAttribute("ui.class", "untrustworthy");
edge.addAttribute("ui.class", "trustworthy");
edge.setAttribute("ui.color", strengthOfTrust/4.0);
}

}

graph.display();
}
Kind regards,
Cherie




Archives gérées par MHonArc 2.6.16.

Top of page