Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14848 > unrolled thread
| Started by | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| First post | 2013-06-14 08:49 +0000 |
| Last post | 2013-06-14 08:49 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Applying data from a database link to a GraphPlot Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2013-06-14 08:49 +0000
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| Date | 2013-06-14 08:49 +0000 |
| Subject | Re: Applying data from a database link to a GraphPlot |
| Message-ID | <kpeled$hrh$1@smc.vnet.net> |
You have a list of lists and you want a list of rules.
Check Apply.
dat = {{"PENELOPE", "GUINESS"}, {"NICK", "WAHLBERG"}, {"ED",
"CHASE"}, {"JENNIFER", "DAVIS"}, {"JOHNNY",
"LOLLOBRIGIDA"}, {"BETTE", "NICHOLSON"}, {"GRACE",
"MOSTEL"}, {"MATTHEW", "JOHANSSON"}, {"JOE",
"SWANK"}, {"CHRISTIAN", "GABLE"}}
Apply[Rule, dat, 2]
Ulrich
Am 13.06.2013 um 08:38 schrieb Paul Pikowsky:
> 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.
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web