Problem
I do not understand Mathematica's Documentation for Labeled
, VertexLabels
, VertexRenderingFunction
, etc
I want to make a Graph
that has Tooltip
enabled for verticies and edges, has PopupWindow
enabled for the verticies, has different colors for edges of different type, different colors for specific verticies, and smaller arrows, etc.
Example
I have a list of index pairs, e.g.
indexList = {
{1,3},{1,4},{1,5},
{4,2},{4,1},
{5,2}
};
Just for purpose of this example lets say I have a list with labels for my verticies and edges
vertexLabels = {"a","b","c","d","e"};
edgeLabels = {"e1","e2","e3","e4","e5","e6"};
Convert index pairs to directed edges
directedEdges = Table[indexList[[i]][[1]] \[DirectedEdge] indexList[[i]][[2]],{i,1,Length[indexList]}];
Apply Tooltip
to directed edges
directedEdgesTooltip = Table[Tooltip[directedEdges[[i]], edgeLabels[[i]]],{i,1,Length[directedEdges]}];
But supposedily one can use Labeled
directedEdgesLabeled = Table[Labeled[directedEdges[[i]], edgeLabels[[i]],Tooltip],{i,1,Length[directedEdges]}];
Calling Graph
on this works-ish
Graph[directedEdgesLabeled]
But that isn't how it should work. Supposedily I should call
Graph[directedEdges,EdgeLabels -> directedEdgesLabeled]
But that doesn't work. As you'll see this goes on for Verticies too.
Apply Tooltip
to Verticies
verticiesLabeled = Table[Labeled[Range[5][[i]], vertexLabels[[i]],Tooltip],{i,1,Length[Range[5]]}];
So lets try again
Graph[directedEdges, VertexLabels -> verticiesLabeled]
Oh darn... that doesn't work.
What about using Tooltip
on the directedEdges? Well that works, if you only want the vertex labeled.
Note
Nesting Labeled
does not work
Labeled[Labeled[1, "a", Tooltip] \[DirectedEdge] Labeled[2, "b", Tooltip], "e1", Tooltip]
Question
So please someone tell me how to do this. We haven't even got into adding PopupWindow
(which I have tried a myraid of methods for).
GraphPlot
is the old way of plotting graphs and has mostly been replaced byGraph
since version 8.0. $\endgroup$GraphPlot
was brought into existance... Anyway usingGraph
with the graph I described above does not work, which is why I gravitated towardsGraphPlot
because that actually produced a graphic $\endgroup$Graph
. It's not the same. $\endgroup$