1

I need to a Mathematica command that takes a set like:

{{472031, 472211}, {472031, 473012}, {472031, 472181}, {472031, 472051}, {472031, 472061}, {472031, 472132}, {472031, 472152}, {472031, 473011}, {472031, 474031}, {472031, 472111}, {472031, 473015}, {472031, 473013}, {472031, 471011}, {472031, 499021}, {472031, 491011}, {472031, 119021}, {472031, 131051}, {472051, 472031}, {472051, 473011}, {472051, 472181}, {472051, 472061}, {472051, 473012}, {472051, 472132}, {472051, 474031}}

and builds another set in LayeredGraphPlot format:

{{"472031" -> "472211"}, {"472031" -> "473012"}, {"472031" -> "472181"}, {"472031" -> "472051"}, {"472031" -> "472061"}, {"472031" -> "472132}", {"472031" -> "472152"}, {"472031" -> "473011"}, {"472031" -> "474031"}, {"472031" -> "472111"}, {"472031" -> "473015"}, {"472031" -> "473013"}, {"472031" -> "471011"}, {"472031" -> "499021"}, {"472031" -> "491011"}, {"472031" -> "119021"}, {"472031" -> "131051"}, {"472051" -> "472031"}, {"472051" -> "473011"}, {"472051" -> "472181"}, {"472051" -> "472061"}, {"472051" -> "473012"}, {"472051" -> "472132"}, {"472051" -> "474031"}}

Thank you.

1 Answers1

2

To get the data exactly as you have shown it:

a={{472031, 472211}, {472031, 473012}, {472031, 472181}, {472031, 472051}, {472031, 472061}, {472031, 472132}, {472031, 472152}, {472031, 473011}, {472031, 474031}, {472031, 472111}, {472031, 473015}, {472031, 473013}, {472031, 471011}, {472031, 499021}, {472031, 491011}, {472031, 119021}, {472031, 131051}, {472051, 472031}, {472051, 473011}, {472051, 472181}, {472051, 472061}, {472051, 473012}, {472051, 472132}, {472051, 474031}};

toQuotedString[x_]:="\""<>ToString@x<>"\"";
{#1 -> #2} & @@@ Map[toQuotedString, a, {-1}]
N.J.Evans
  • 5,093
  • 19
  • 25