Creating Graph with two or more values in second column

For a social network analysis I have two columns. The second column has one, two or more values. Something like this:

data = {{A, {k, l, m}}, {B, {k, l, m, n, o}}, {C, {m, n, o}}}


I would like to make a relation between te value of the first column and for each value in the second column. So I would like to get:

data1 = {A -> k, A -> l, A -> m, B -> k,  B -> l, B -> m, B -> n,
B -> o, C -> m, C -> n, C -> o}


Anyone a suggestion how to solve this?

-

data = {{A, {k, l, m}}, {B, {k, l, m, n, o}}, {C, {m, n, o}}}

Flatten@(Thread[#[[1]] -> #[[2]]] & /@ data)

(* {A->k,A->l,A->m,B->k,B->l,B->m,B->n,B->o,C->m,C->n,C->o} *)

-

Maybe I will delete this answer later, but just for good fun (using Riffle and a funky feature of Partition :P)

Quiet[
List @@
Partition[
Apply[Rule, Delete[Riffle[#[[2]], #[[1]], {1, -2, 2}], 0] & /@ data],
2, 2, {1, -1}, {}]
]


Also quite silly

Delete[Thread@Rule@##, 0] & @@@ data

-
+1 for the laugh ;-} – ciao Apr 9 '14 at 21:39

Not so much different but without slots (#):

Rule @@@ Flatten[Thread /@ data, 1]

-