I am trying to create an EdgeRenderingFunction
but the more information
does not help me at all as far as explaining what the mathematical structure of the input is and at what level , the number of @s, mathematica makes the function act and the mathematical structure of the output.
I would like to be able to create a pure function that does:
- If the initial vertex is "j" then color should be "color[j]"
- If the end vertex is "k" then the thickness should be "Thickness[k]"
- If the relation is
"->"
then the label should be whatever" and position "somewhere", if the relation is"-"
then the label should be "whateverelse" and position "somewhere else".
Wolfram more information says:
EdgeRenderingFunction->g specifies that each edge should be rendered with the graphics primitives given by g[{ri..},{vi..},lbij], where ri , rj are the beginning and ending points of the edge,vi ,vj are the beginning and ending vertices, lbij the is any label specified for the edge.
Typically, in math, if "g"
is a function then g[something]
signifies that the "something"
is the input and "g[something]"
is the output. But if "ri"
are coordinates, "vi"
are vertices and "lb"
are labels then the "something"
is intended to be the output of g[input]. So I'm a bit confused by the "more information" and would appreciate some help here.
My other questions are:
- What is the mathematical structure of the input graph {1->2}?
Someone showed me yesterday in chat but I have forgotten how to replicate it, that:
{1->2}
is collection of lists where the first list carries the vertices in order
and the second list carries the direction in order.
{1->2} is stored as {{1,2},{Rule[1,2]}}
- what does this Rule look like? How can I write functions on this rule?
Confusingly
(#2[[1]] &) @@ {{1, 2}, {"a"}}
a
But
(#2[[1]] &) @@ {1 -> 2}
2
but with an error message
On the other hand
(#[[2]] &) @@ {1 -> 2}
2
No errors.
So if a Graph
is stored as a list of lists that I am atting @@
at a second level then shouldn't I have found the Rule between 1 and 2?
- How many
@@@
levels is mathematica gonna make myedgerenderingfunction
act on to the input?