1

I want to make list of subscripted symbols in functional way. So that given edges list I can get something like the list below/

edges = {1 \[DirectedEdge] 3, 1 \[DirectedEdge] 5, 2 \[DirectedEdge] 1, 
     2 \[DirectedEdge] 6, 5 \[DirectedEdge] 2, 5 \[DirectedEdge] 6, 
     6 \[DirectedEdge] 1, 6 \[DirectedEdge] 4}
{Subscript[x, 1 \[DirectedEdge] 3], Subscript[x, 
 1 \[DirectedEdge] 5], Subscript[x, 2 \[DirectedEdge] 1], Subscript[x,
  2 \[DirectedEdge] 6], Subscript[x, 
 5 \[DirectedEdge] 2], Subscript[x, 5 \[DirectedEdge] 6], Subscript[x,
  6 \[DirectedEdge] 1], Subscript[x, 6 \[DirectedEdge] 4]}
GrozaiL
  • 183
  • 6

1 Answers1

4

Found solution by myself.

Subscript[x, #] & /@ edges

My mistake was that I tried

Subscript[x, #&]  /@ edges
GrozaiL
  • 183
  • 6
  • 3
    Nice job figuring that out. – Rabbit Feb 20 '18 at 00:46
  • 1
    Indeed, good job. And welcome on Mathematica.StackExchange! Just a hint: Try to avoid Subscript (except only for display). Internally, it works differently than you would expect and leads to lots of undesired behavior. Just search for Subscript on this site and you will find a plethoria of these issues. See also here or here – Henrik Schumacher Feb 20 '18 at 08:12