A computer science question

Peter Haworth pete at lcsql.com
Tue Feb 10 20:50:06 EST 2015


Thanks Ken, trying to understand it! I guess the vertices would be tables
and the edges would be pairs of tables with a foreign key relationship.

The lightbulb for me is that the table objects don't need to be in rows and
columns, they are positioned in the best place for the lines that join them.

Now all I need to is learn js so I can translate it to lc!

Pete
lcSQL Software
On Feb 10, 2015 11:04 AM, <ken at kencorey.com> wrote:

> I think you’re looking for a clever application of a “Force-Directed
> Graph” drawing algorithm
>
> https://en.wikipedia.org/wiki/Force-directed_graph_drawing
>
>
> There are whole books to this field, but there’s a sample web page with an
> algorithm done in javascript here:
>
> http://getspringy.com
>
>
> -Ken
>
>
>
>
>
>
> Sent from Windows Mail
>
>
>
>
>
> From: Peter Haworth
> Sent: ‎Tuesday‎, ‎10‎ ‎February‎ ‎2015 ‎18‎:‎23
> To: How to use LiveCode
>
>
>
>
>
> I've managed to get by for many years without the benefit of any formal
> computer science training but I think I've finally run into a situation
> which is probably solvable by a computer science algorithm.
>
> I want to implement a database diagram feature in my SQLiteAdmin program
> with a graphic to represent each table and lines connecting tables that
> have a foreign key relationship.
>
> The first challenge was to arrange the tables in a series of levels with
> the tables that are not referenced in any foreign keys at the top the
> second level with tables that reference the top level, and so on.  That I
> have figured out with a nice recursive handler.
>
> Now I'm faced with the issue of drawing the relationship lines.  Currently
> the tables at each level are arranged in alphabetical order but that pretty
> much guarantees that a table graphic will not be in the optimal position to
> be connected to its parent table.
>
> For example, I'm looking at a diagram where the table at the top left needs
> a line drawn to the table at the bottom right.  Ideally the table at the
> bottom right should be placed at the bottom left (or somewhere close) so
> the connecting line can drawn from it to the table at the top left.
>
> I'm guessing there is a computer science algorithm that will place the
> table graphics in the optimal position for the connection lines to be
> drawn.  Can anyone point me to that algorithm?
>
> Pete
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list