[vtkusers] vtkGraph: Specifying distances between all pairs of nodes for Force Directed placement
Amina Shabbeer
aminashabbeer at gmail.com
Mon Oct 25 10:02:06 EDT 2010
Yes, Im sorry I should have specified. I need to specify weights/distances
between nodes that are not connected by edges as well. I can use the edge
weight strategy for neighbours, but what do I do for nodes not connected by
edges?
thanks,
amina
On Mon, Oct 25, 2010 at 8:46 AM, David Doria <daviddoria at gmail.com> wrote:
> On Mon, Oct 25, 2010 at 8:39 AM, Eric E. Monson <emonson at cs.duke.edu>
> wrote:
> >
> > Hello Amina,
> >
> > The graph layout strategies (at least the force-directed types I'm
> familiar with) work with the concept of an edge "weight" instead of a
> distance. So, because a strong weight would tend to end up as a short
> distance after the layout, you might be able to get your desired results by
> inverting your distances to make weights. I hope you realize, though, that
> it's impossible to flatten an arbitrary graph into 2D while specifying all
> of the node-node distances, so some of the spacings may not end up exactly
> as you hope.
> >
> > One way to construct the graph is to create a table with three columns.
> The first two contain indices that specify which vertices edges will run
> between, and the third column is the edge weight. Then, use vtkTableToGraph
> to create the graph (and the graph edges will contain the weight). If column
> 1 is called "index1", and column 2 is called "index2" (and column 3 is
> called "weight"), you would run something like (this is Python):
> >
> > tgraph = vtk.vtkTableToGraph()
> > tgraph.SetInput(table)
> > tgraph.AddLinkVertex('index2', 'stuff', False)
> > tgraph.AddLinkVertex('index1', 'stuff', False)
> > tgraph.AddLinkEdge('index2', 'index1')
> >
> > Other examples are linked from the doc page:
> > http://www.vtk.org/doc/nightly/html/classvtkTableToGraph.html
> >
> > Hope this helps get you started,
> > -Eric
>
>
> I believe Amina is looking to also specify distances between vertices
> that do not have an edge between them:
>
> > "given distances between all pairs of nodes"
>
> Is that correct Amina?
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101025/c4454ea6/attachment.htm>
More information about the vtkusers
mailing list