[vtkusers] [Graph] Representing size of weights with edges between vertices

Eric E. Monson emonson at cs.duke.edu
Tue Oct 19 07:39:28 EDT 2010


Hey Henry,

Last time I checked, the VTK graph displaying methods do not include a way to map edge weight to thickness (I'm sure someone will correct me if I'm wrong). I have had good luck, though, using thicker lines and then creating a vtkViewTheme which includes an alpha range (I think edges should be controlled with CellAlphaRange) to map both color and opacity to edge weight. With this, strong edges are thick and prominent, and weak edges start to disappear (depending on the range you set).

My guess is that with the type of data you have, the layout strategies you've already tried will be a good solution. Fast2D will give you similar results, but may be faster in some cases. Community2D relies on knowing which vertices correspond to each "community". I'm not sure how Clustering2D is different than the first ones (so maybe someone else can speak up about that), but it's another one you might want to try to compare. Many of the others rely on having trees, or other special types of graphs.

To tune your visual representation you'll always have to have some sort of training data set where you know what you should see, and then see if that is what's displayed. You could always try scaling the edge weights that are used in the layout (by some power, maybe) if you just want the visual representation to be different, then make a way for the reported values to be the original ones. I've also has good luck using a threshold on the edge weights used for the graph layout, so any small-weight edges are removed (just check to make sure you keep some minimum number of nearest neighbors for each node). Again, other calculations can use the original values, but if there are a lot of edges, you might get a nicer visual representation that will be closer to what you want with fewer edges. Remember, you're trying to take a bunch of high-dimensional relationships and flatten them out to 2D, so if you can make that problem easier for the algorithms you might get something more "pleasing".

Good luck,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Oct 18, 2010, at 9:55 PM, Henry wrote:

> I wonder what is the best strategy to plot a graph that has to represent similar texts. Each vertex is a text, and each edge is how far one is from another text. The shorter the distance, the texts are more similar. Thus, a graph that represents good these distances exhibit several separate groups of vertices well separated in space. With that I could identify easily texts similar.
> I tried to use some strategies like:
> 
> strategy = vtkForceDirectedLayoutStrategy()
> and
> strategy = vtkSimple2DLayoutStrategy()
> 
> As I do not know how they work, and if there are other ways to do better what I want, I'm here writing.
> 
> Is there any way to visually represent the weights in a graph? So that the edges with larger weights get bigger and the edges of smaller weights them smaller, visually... 
> Any suggestions on how to do something? If I use vtkForceDirectedLayoutStrategy (), some vertex groups are formed. They are well formed in this context? It seemed to me that, but I do not know how well the graph left. I did some tests to identify the vertices together and they were really like. But the edges do not represent the weight, just show a number indicating the weight.
> 
> Thank you,
> Henry
> 
> PS I'm using Python to do this work.
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101019/2cba18ff/attachment.htm>


More information about the vtkusers mailing list