I have a bunch of high dimensional data and I want to use a graph to plot relationships among that data. To keep things small, say the data is
d[x_, y_] := Total[Abs[x - y]];
data = RandomReal[{0, 1}, {10, 5}];
RelationGraph[0.2 < d[#1, #2] < 1.5 &, data, data]
This draws a nice graph of all the elements whose distance apart is between 0.2 and 1.5. If I want to label the graph with the index number, then
RelationGraph[0.2 < d[#1, #2] < 1.5 &, dist, dist, VertexLabels -> "Index"]
works fine. But if I want to use my own labels, Mathematica does not draw the graph and simply returns the input unchanged. For example, neither of these:
RelationGraph[0.2 < d[#1, #2] < 1.5 &, dist, dist,
VertexLabels -> {1 -> "this", 2 -> "that"}]
RelationGraph[0.2 < d[#1, #2] < 1.5 &, dist, dist,
VertexLabels -> Table[i -> Subscript[v, i], {i, 5}]]
return any graph. Is there a trick to using VertexLabels? Or do I need to search for another way to draw the graphs?
Table[dist[[i]] -> Subscript[v, i], {i, 5}]
- it takes the element's value not the position. $\endgroup$