I am working with Graphs in which I want to define a Graph with Symbols or Strings as EdgeLabels, and later replace these with functions of the symbols with symbols then replaced with numerical values. I have tried using Replace without success. I can replace the symbols with numerical values by setting the values of the symbols, but that does not allow for replacing the symbol by a function of the symbol first.
Below are my unsuccessful attempts:
g = Graph[{1 \[DirectedEdge] 2, 2 \[DirectedEdge] 3},
EdgeLabels -> {1 \[DirectedEdge] 2 -> x, 2 \[DirectedEdge] 3 -> y}]
g // FullForm
(replacements doesn't work)
values = {x -> 1, y -> 2};
g /. values
(a more complicated case)
g /. Rule[DirectedEdge[n1_, n2_], s_] ->
Rule[DirectedEdge[n1, n2], 1/s]
(this does work, but doesn't fulfill the need for more complicated
replacements)
x = z;
g

