Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Importing data into GraphPlot from a database' topicStudent Support Forum > General > Archives > "Importing data into GraphPlot from a database"

Next Comment >Help | Reply To Topic
Author Comment/Response
Paul
06/12/13 6:04pm

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.

URL: ,

Subject (listing for 'Importing data into GraphPlot from a database')
Author Date Posted
Importing data into GraphPlot from a database Paul 06/12/13 6:04pm
Re: Importing data into GraphPlot from a database Bill Simpson 06/13/13 00:52am
Re: Importing data into GraphPlot from a database yehuda 06/13/13 11:33am
Next Comment >Help | Reply To Topic