Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » ZEST graph viewer crashes to draw large graph.(ZEST graph viewer crashes to draw large graph.)
ZEST graph viewer crashes to draw large graph. [message #552273] Wed, 11 August 2010 10:42
syeed is currently offline syeed
Messages: 19
Registered: June 2010
Junior Member
Hi,
I am using ZEST and JFace Graph viewer to build a graph visalization tool. I used "IGraphContentProvider" for drawing the grpah.

Usually i need to draw graph having huge number of edges ( for example: over 40000). But whenever i give this number of edges to the viewer, its simply unable to draw it or took lot of time to draw it.

Could you please provide some solution.

Follwing is my content provider for the graph viewer. Please take a look.

public class GraphViewContentProvider implements IGraphContentProvider {

/*
this map holds the edge list. "key" contains edge as source:destination:edgeWeight and "value" contains edge detail. */
private Map<String,String> edgeList;

public Object getDestination(Object rel) {
String string = (String) rel;
String[] parts = string.split(":");

//if there is no destination node.
if (parts[1].equalsIgnoreCase("nil"))
return null;
else
return parts[1];
}

public Object[] getElements(Object input)
{
ArrayList listOfEdges = new ArrayList();

Set set = edgeList.entrySet();

Iterator it=set.iterator();

//get all the edges from the map and form the list
while(it.hasNext())
{
Map.Entry entry =(Map.Entry)it.next();

// getKey is used to get key of Map
String key=(String) entry.getKey();
listOfEdges.add(key);
}
return listOfEdges.toArray();
}

public Object getSource(Object rel) {
String string = (String) rel;
String[] parts = string.split(":");

//if there is no source node.
if (parts[0].equalsIgnoreCase("nil"))
return null;
else
return parts[0];
}

public double getWeight(Object connection) {
return 0;
}
public void dispose() {

}

public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// if the edgelist is changed then set it as new input.
if (newInput != null) {
edgeList = (Map)newInput;
}
}

}

Thanks in advance.

-syeed
Previous Topic:GEF install on clean Helios Win64 not functioning
Next Topic:Question about views
Goto Forum:
  


Current Time: Mon Jul 28 00:28:47 EDT 2014

Powered by FUDForum. Page generated in 0.02569 seconds