# Turning evaluation off

I am making a directed graph, but Mathematica keeps trying to evaluate my labels. I know that I can just use " ", but I have a lot of input. Is there a way to turn evaluation off?

LayeredGraphPlot[{"C1.4.4" -> "T1.5.7", "1.23" -> "L1.5.4",
"P1.4.3" -> "C1.4.4", "P1.4.3" -> "C1.1.4", "P1.1.9" -> "P1.5.2",
"P1.1.9" -> "L1.5.3", "P1.5.2" -> "T1.5.7", "L1.5.3" -> "T1.5.7",
"L1.5.4" -> "T1.5.7", "P1.5.5" -> "T1.5.7", "L1.4.6" -> "L1.4.7"},
VertexLabeling -> True]

-
Welcome. Your code works for me as expected. What is the evaluation looking like? – Matariki Jul 14 '12 at 10:46
In principles you could use Map to wrap ToString around the expressions at each side of each rule, but if you take the quote marks off, Mathematica interprets "C1.4.4" as C1 * 0.4 * 0.4, i.e. 0.16 C1. There should be some version of HoldForm that works but it seems almost impossible to define a function that performs the transformation without releasing Hold somewhere along the line. – Verbeia Jul 14 '12 at 11:06
Welcome to Mathematica.SE, by the way! Please consider registering your account so that the upvotes you get on any future questions and answers will be added to the ones you received for this one. – Verbeia Jul 14 '12 at 23:11

Not sure how robust this is but instead of putting quotation marks around the individual vertex labels, you could do something like

split[rulelst_String] := Rule @@@ Partition[
StringTrim /@ StringSplit[rulelst, {"->", "\[Rule]", ",", "{", "}"}], 2]

LayeredGraphPlot[
split["{C1.4.4 -> T1.5.7, 1.23 -> L1.5.4, P1.4.3 -> C1.4.4, P1.4.3 ->
C1.1.4, P1.1.9 -> P1.5.2, P1.1.9 -> L1.5.3, P1.5.2 -> T1.5.7, L1.5.3 ->
T1.5.7, L1.5.4 -> T1.5.7, P1.5.5 -> T1.5.7, L1.4.6 -> L1.4.7}"],
VertexLabeling -> True]


-

If you take the quote marks out, Mathematica interprets "C1.4.4" as C1 * 0.4 * 0.4, i.e. 0.16 C1.

This works for a single label, but doesn't if you create a function that operates on different bits of rules.

StringJoin @@ StringReplace[(ToString /@ First[List @@@ Hold[C1 .4 .4]]),
"0" -> ""]

(* returns string "C1.4.4" *)


But it should point you in the right direction.

-