Re: Graph Layout Application using GTK and Gnome



On Fri, 15 Mar 2002 19:03:43 -0000
"Anton Enright" <anton ebi ac uk> wrote:

Dear All,

I'm writing a graph layout application which produces near optimal
layouts of complex biological graphs.

The graphs consist of nodes (circles on the graph) and edges (lines
which connect nodes).

I'm using the gnome canvas to produce very nice graphs, and I've got
code to easily move nodes (but not edges).

The problem I want to address is how to get edges to follow a node when
it is moved. I saw a previous posting where someone had a similar problem
and people suggested getting edges to listen for motion events concerning
the
two nodes they are connected to.

Does anyone know how to implement this easily ? Or am I approaching the
whole situation in the wrong way.

In your data structure for the nodes, add an GPtrArray that holds a pointer to
every edge connected to that node. This will cost you some memory, since every
edge is recorded (at least) twice, but you save on searching.

Roland
-- 
R.F. Smith                         "I have made this letter longer than usual
r s m i t h @ x s 4 a l l . n l     because I lack the time to make it shorter"
http://www.xs4all.nl/~rsmith/                             -- Blaise Pascal
I filter my mail. See http://www.xs4all.nl/~rsmith/spamblock.html for details.

Attachment: pgpCOSUEw9mh4.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]