Message Boards Message Boards

More on bug of multiple edges graphs

Posted 9 years ago

Hi,

In

Initial post on multiple eges issue

I brought up the multiple edges bug which in principle seemed to affect only to colours in EdgeStyle.

A member of the Community, kindly posted a patch which solved the colours issue for the example that I presented. But the patch only dealt with the edges colour issue while in fact the bug affected the whole treatment of multiple edges (tooltips, hyperlinks, buttons, …), in other words, all the wrappers given in the ‘Details and Options’ “ref/HighlightGraph”. The output produced by the the patch loooks as below

enter image description here

There, the color of the multiple edges are printed correctly. (The problem could be better understood by reviewing the inked posts).

In

Post asking about V10.3 and the issue on multiple edges

I asked whether the bug had been solved in the new release 10.3, In case I decided to upgrade from 10.2. The answer to my question as given for another Community member was “Not, it hasn’t” (I thanks him for it). Then I suggested WRI to provide a free patch to minimize the impact of this not documented and highly important shortcoming (and surely known to Wolfram) of the new feature, (the multiple edges support) released in the first delivery of version 10.

Still, I noted in my post that the patch supplied by Jaebum set the way to the solution, and so I looked around for some provisional way out.

The following is a complement to the patch which, for the time being is enough for me, in case it be of any use for others. Here I attach tooltips and hyperlinks to multiple edges, and it seems that in the same form all other stuff can be attached.

Clear@ttFuncSet
ttFuncSet[edge_, ttlist_] := 
 With[{a = Unique["x"]}, {Inactive[a], 
   Inactive[edge -> (a = 0; {a++; ttlist[[a]]})]}]
Clear@SetttFunction
SetttFunction[edgtteset_] := 
 Block[{gather}, 
  gather = ttFuncSet[#[[1, 1]], #[[All, 2]]] & /@ 
    GatherBy[edgtteset, First];
  (With[{var = gather[[All, 1]], cont = gather[[All, 2]]}, 
     Hold@Module[var, cont]] /. Inactive[x_] :> x)]

shape = Function[color, 
   Graphics[{Circle[], color, Disk[]} , ImageSize -> 10]];

edgeTTsets = {"P" \[DirectedEdge] "M" -> 
    Placed[Hyperlink["Hyperlink", 
      "http://community.wolfram.com"], .6], 
   "M" \[DirectedEdge] "P" -> 
    Placed[Tooltip[Column[{shape[Red], "Tooltip"}, Center], 
      "M \[DirectedEdge] P"], .6], 
   "P" \[DirectedEdge] "Q" -> Placed["Name", Tooltip], 
   "Q" \[DirectedEdge] "M" -> Placed["Name", Tooltip], 
   "M" \[DirectedEdge] "V" -> Placed["Name", Tooltip], 
   "V" \[DirectedEdge] "M" -> Placed["Name", Tooltip], 
   "P" \[DirectedEdge] "V" -> Placed["Name", Tooltip], 
   "Q" \[DirectedEdge] "V" -> Placed["Name", Tooltip], 
   "V" \[DirectedEdge] "P" -> Placed["Name", Tooltip], 
   "V" \[DirectedEdge] "Q" -> Placed["Name", Tooltip], 
   "P" \[DirectedEdge] "Q" -> Placed["Name", Tooltip], 
   "Q" \[DirectedEdge] "M" -> Placed["Name", Tooltip], 
   "M" \[DirectedEdge] "Q" -> Placed["Name", Tooltip], 
   "P" \[DirectedEdge] "V" -> Placed["Name", Tooltip], 
   "V" \[DirectedEdge] "Q" -> Placed["Name", Tooltip], 
   "M" \[DirectedEdge] "V" -> Placed["Name", Tooltip], 
   "P" \[DirectedEdge] "Q" -> Placed["Name", Tooltip]};


ttedges = SetttFunction[edgeTTsets];
coloredges = SetColorFunction[edgesets];
Panel[
 MVPQGraph = 
  Graph[{"M", "V", "P", "Q"}, edgesets[[All, 1]], VertexSize -> .09, 
   VertexLabels -> Placed["Name", Center], 
   VertexShapeFunction -> "RoundedSquare", 
   VertexStyle -> Hue[0.125, 0.7, 0.9], 
   VertexLabelStyle -> Directive[Bold, FontFamily -> "Arial", 12], 
   EdgeStyle -> Arrowheads[{{.03, .4}}], 
   EdgeShapeFunction -> ReleaseHold[coloredges], 
   EdgeLabels -> ((#[[1]] -> First[#[[2]]]) & /@ ReleaseHold[ttedges])
    ], Column[{Style[
    "All edges except those labeled carry tooltips along their \
shape", Bold, Blue], 
   "Edges labeled 'Tooltip' and 'Hyperlink' carry the named active \
objects" , "Run the code and mouse over them to check it" }]]

My code is nothing but a rewriting of Jaebum's code, but it generates the following picture, including tooltips and hyperlinks. I guess the approach would workl with all the wrappers mentioned in Help on HighlightGraph

enter image description here.

The above suggests that, in fact, the free patch Wolfram would (or perhas should) provide is something neither very difficult not costly to implement: as far as the patch above worked for any number (more that four) vertices.

That is my humble view, in case it be of any use for Community members who need it.

Martin.

POSTED BY: E Martin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract