Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Applying data from a database link to a GraphPlot
Replies: 4   Last Post: Jun 16, 2013 5:13 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bob Hanlon

Posts: 906
Registered: 10/29/11
Re: Applying data from a database link to a GraphPlot
Posted: Jun 14, 2013 4:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


data = {{"PENELOPE", "GUINESS"}, {"NICK", "WAHLBERG"}, {"ED",
"CHASE"}, {"JENNIFER", "DAVIS"}, {"JOHNNY", "LOLLOBRIGIDA"}, {"BETTE",
"NICHOLSON"}, {"GRACE", "MOSTEL"}, {"MATTHEW", "JOHANSSON"}, {"JOE",
"SWANK"}, {"CHRISTIAN", "GABLE"}};


GraphPlot[Rule @@@ data, VertexLabeling -> All]



Bob Hanlon




On Thu, Jun 13, 2013 at 2:38 AM, Paul Pikowsky <ppksky@gmail.com> wrote:

> This is my first project and I am trying to import data from a MySQL query
> into a GraphPlot expression.
>
> A return from MySQL (Sakila is the example here)
>
> SQLExecute[conn, "SELECT first_name, last_name FROM actor LIMIT 10"]
>
> {{"PENELOPE", "GUINESS"}, {"NICK", "WAHLBERG"}, {"ED",
> "CHASE"}, {"JENNIFER", "DAVIS"}, {"JOHNNY",
> "LOLLOBRIGIDA"}, {"BETTE", "NICHOLSON"}, {"GRACE",
> "MOSTEL"}, {"MATTHEW", "JOHANSSON"}, {"JOE", "SWANK"}, {"CHRISTIAN",
> "GABLE"}}
>
> (This is not the intended data, just a sample of the output.)
>
> But GraphPlot uses inputs of the form,
>
> GraphPlot[{"d" -> "c", "e" -> "b", "e" -> "c", "e" -> "d", "f" -> "a",
> "f" -> "b", "f" -> "d", "f" -> "e", "g" -> "a", "g" -> "b",
> "g" -> "c", "g" -> "e"}, VertexLabeling -> True]
>
> Is there some way in place of converting the output of a data query to the
> input of a graphplot? I see that an adjacency matrix is an optional input,
> but I'd also want to use labels generated from the database.
>
>





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.