Bug 540596 - DOT Graph View - NPE displaying dot file containing nested subgraphs
Summary: DOT Graph View - NPE displaying dot file containing nested subgraphs
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF DOT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-30 05:33 EDT by Ed Willink CLA
Modified: 2018-11-30 12:24 EST (History)
1 user (show)

See Also:


Attachments
com.abstratt.mdd.oss.repository-2.2.zip rendering (108.13 KB, image/png)
2018-11-10 12:04 EST, Ed Willink CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2018-10-30 05:33:02 EDT
I have been using com.abstratt.mdd.oss.repository-2.2.zip for a few years and was prompted by recent forum postings to give the GEF DOT View another try....

The (autogenerated) file below gives an NPE in the GEF DOT View.

digraph schedule {fontname=arial;edge [fontname=arial,penwidth=2,arrowsize=1.5];node [shape=rectangle,fontname=arial,penwidth=2];nodesep=1;ranksep=1;compound=true;
  subgraph cluster_0 {
    color=green;
    label="HSV2HSLRecursion«local»";
    a1[penwidth=4,color=blue,style="rounded",label="hsv\nHSV"]
    {rank=source;a2[head=true,penwidth=8,color=blue,style="",label="hsvNode\nHSVNode"]}
    a3[penwidth=4,color=red,style="",label="middleNode\nHSVNode2HSLNode"]
    a4[penwidth=4,color=blue,style="",label="hsvParent\nHSVNode"]
    a5[penwidth=4,color=blue,style="rounded",label="name\nString"]
    a2 -> a5[headlabel="name\n[1]",penwidth=4,color=blue,arrowhead=normal]
    a2 -> a4[headlabel="parent\n[?]",penwidth=4,color=blue,arrowhead=normal]
    a2 -> a1[headlabel="hsv\n[1]",penwidth=4,color=blue,arrowhead=normal]
    a3 -> a5[headlabel="name\n[1]",penwidth=4,color=green3,arrowhead=normal]
    a3 -> a2[headlabel="hsv\n[1]",penwidth=4,color=green3,taillabel="middle\n[?]",arrowhead=normal,dir=both,arrowtail=vee]
  }
}

(Quite apart from the NPE, the partial picyure shows an inability to handle clusters or new-lines in labels.)
Comment 1 Tamas Miklossy CLA 2018-11-01 08:42:59 EDT
New lines in labels are already supported by the GEF DOT Graph view, it seems to be a problem with nested subgraphs (subgraphs defined in subgraphs).
Comment 2 Tamas Miklossy CLA 2018-11-10 10:33:51 EST
Hello Ed!

I pushed the following changes to the master branch:

[540596] DOT Graph View - add support for rendering nested subgraphs.

- Modify the Dot2ZestGraphCopier to recursively transform the nested
subgraphs (subgraphs defined in subgraphs) from DOT to Zest.
- Implement corresponding Dot2ZestGraphCopierTests test cases.

Could you please give it a try with the latest build and confirm that the dot graph you mentioned above can be visualized without an NPE?
Comment 3 Ed Willink CLA 2018-11-10 12:04:28 EST
Created attachment 276539 [details]
com.abstratt.mdd.oss.repository-2.2.zip rendering
Comment 4 Ed Willink CLA 2018-11-10 12:05:22 EST
(In reply to Tamas Miklossy from comment #2)
> Could you please give it a try with the latest build and confirm that the
> dot graph you mentioned above can be visualized without an NPE?

Sorry. The 5.0.200/I201811100306/GEF-Update-5.0.200.zip males no difference.

The graph below does sort of display, but in comparison to com.abstratt.mdd.oss.repository-2.2.zip (screenshot attached)

- the layout is poor
- nodes overlap
- lines do not end at the node 'centre'
- the layout fails to find the layout where no lines are upwards
- nodes are not sized to fit their text
- the title is missing
- the surrounding box is missing

digraph schedule {fontname=arial;edge [fontname=arial,penwidth=2,arrowsize=1.5];node [shape=rectangle,fontname=arial,penwidth=2];nodesep=1;ranksep=1;compound=true;
  subgraph cluster_0 {
    color=green;
    label="hsv2hsl";
    a1[color=green,label="HSV2HSLRecursion«edge-parent»"]
    a2[color=green,label="HSV2HSLRecursion«global»"]
    a3[color=green,label="HSV2HSLRecursion«local»"]
    a4[color=green,label="HSV2HSLRecursion«speculated»"]
    a5[color=green,label="HSV2HSLRoot"]
    a6[color=green,label="HSV2HSL-«load»"]
    a7[penwidth=2,shape=ellipse,color=darkorange,label="ji_HSVNode"]
    a6 -> a7[penwidth=2,color=darkorange]
    a7 -> a3[penwidth=2,color=darkorange]
    a7 -> a5[penwidth=2,color=darkorange]
    a8[penwidth=2,shape=ellipse,color=darkorange,style=dotted,label="jo_HSLNode"]
    a4 -> a8[penwidth=2,color=darkorange,style=dotted]
    a5 -> a8[penwidth=2,color=darkorange,style=dotted]
    a8 -> a1[penwidth=2,color=darkorange,style=dotted]
    a9[penwidth=2,shape=ellipse,color=brown,style=dotted,label="je_HSVNode2HSLNode_hsv"]
    a5 -> a9[penwidth=2,color=brown,style=dotted]
    a3 -> a9[penwidth=2,color=brown,style=dotted]
    a9 -> a2[penwidth=2,color=brown,style=dotted]
    a10[penwidth=2,shape=ellipse,color=darkorange,label="jm_HSVNode2HSLNode"]
    a3 -> a10[penwidth=2,color=darkorange]
    a10 -> a2[penwidth=2,color=darkorange]
    a10 -> a4[penwidth=2,color=darkorange]
    a10 -> a1[penwidth=2,color=darkorange]
    a11[penwidth=2,shape=ellipse,color=brown,style=dashed,label="je_HSVNode2HSLNode_hsl"]
    a4 -> a11[penwidth=2,color=brown,style=dashed]
    a11 -> a1[penwidth=2,color=brown,style=dashed]
    a12[penwidth=2,shape=ellipse,color=brown,style=dashed,label="je_HSVNode2HSLNode_hsv_1"]
    a3 -> a12[penwidth=2,color=brown,style=dashed]
    a12 -> a2[penwidth=2,color=brown,style=dashed]
    a12 -> a4[penwidth=2,color=brown,style=dashed]
    a13[penwidth=2,shape=ellipse,color=brown,style=dashed,label="je_HSVNode2HSLNode_name"]
    a3 -> a13[penwidth=2,color=brown,style=dashed]
    a13 -> a4[penwidth=2,color=brown,style=dashed]
    a14[penwidth=2,shape=ellipse,color=brown,style=dashed,label="je_HSVNode2HSLNode_parent"]
    a2 -> a14[penwidth=2,color=brown,style=dashed]
    a14 -> a1[penwidth=2,color=brown,style=dashed]
  }
}
Comment 5 Tamas Miklossy CLA 2018-11-10 12:23:38 EST
From your description I guess you are using the DOT Graph View in 'emulated mode'. From the GEF DOT User Guide:

in the 'native mode' representation (when the dot executable is configured, it is used for layouting), or in the 'emulated mode' representation (when the dot executable is not configured, the layouting is emulated by using a comparable Layout algorithm).

https://github.com/eclipse/gef/wiki/DOT-User-Guide

Could you please give it a try with layouting in 'native mode'? In that case the result should be very close to the screenshot you attached.
Comment 6 Ed Willink CLA 2018-11-10 17:25:51 EST
The user guide does not provide clear instructions.

Copying the same executable (C:\Program Files (x86)\Graphviz2.38\bin\dot.exe) from the Graphviz preferences to the DOT->GraphViz preferences makes no difference. If anything it is much worse. I had to fight through 20 NPE popup dialogs before I could do anything.

No idea what extensions I should select or why. Seems like an export tool so why is it used during visualization at all?
Comment 7 Tamas Miklossy CLA 2018-11-11 03:01:56 EST
Actually, the export tool is used by the Sync Graphviz Export and by the DOT Graph View.

From the GEF DOT User Guide:
The Sync Graphviz Export feature uses the Graphviz native executable to export the *.dot files into different image formats such as *.pdf, *.png, *.svg ...etc., which can be configured on the DOT Preference Page.

If you are unsure what extension to select just leave the default pdf value.

I have just installed the latest build from

https://ci.eclipse.org/gef/job/gef-master/lastSuccessfulBuild/artifact/update-site

and I could successfully render both dot graphs you attached without any NPE.

Would you please give it a try with that update site?
Comment 8 Ed Willink CLA 2018-11-12 04:48:13 EST
(In reply to Tamas Miklossy from comment #7)
> I have just installed the latest build from
> 
> https://ci.eclipse.org/gef/job/gef-master/lastSuccessfulBuild/artifact/
> update-site

Ah!. Your earlier comment about install the latest build was not referring to the latest build on the downloads page.

Eventually (for some reason a later build trashed your reference build) 

  https://ci.eclipse.org/gef/job/gef-master/5156/artifact/update-site

shows me some useful progress. 

In native mode the picture is laid out plausbly but:

It jumps a few times, uncertain whether to left-justify or center justify the overall cluster. This suggests that too many paints occur even when stable.

The cluster colour is ignored.

The diagram font (arial) is ignored.

Multiline labels are not centered independently per line, e.g. the " 1" in label="HSV2HSLRecursion«local»\n 1" appears well to the left rather than centered. (The " " preceding " 1" was an empirical tweak anyway. Perhaps this is ill-sepecified.)

The penwidth is ignored.

In emulated mode there are further problems that I reported earlier.
Comment 9 Ed Willink CLA 2018-11-12 04:50:52 EST
(In reply to Ed Willink from comment #8)
> In native mode the picture is laid out plausbly but:

One major plus.

In comparison to com.abstratt.mdd.oss.repository-2.2.zip, DOT View has zooming (and scrolling).
Comment 10 Tamas Miklossy CLA 2018-11-12 16:04:03 EST
Nice to hear that!

I think we should create separate Bugzilla tickets to track the remaining issues you mentioned.
Comment 11 Tamas Miklossy CLA 2018-11-30 08:47:29 EST
I resolve this as fixed in 5.0.300 (2018-12).
Comment 12 Ed Willink CLA 2018-11-30 09:24:55 EST
(In reply to Tamas Miklossy from comment #10)
> Nice to hear that!
> 
> I think we should create separate Bugzilla tickets to track the remaining
> issues you mentioned.

What are the separate Bugzillas?
Comment 13 Tamas Miklossy CLA 2018-11-30 09:47:25 EST
I created the following tickets based on your feedback:

bug 541052 DOT Graph View - add support for rendering cluster colors
bug 541056 DOT Graph View - add support for rendering fonts
bug 541106 DOT Graph View - add support for the penwidth attribute
bug 541108 DOT Graph View - add support for escString (multiline labels)

The problems regarding the 'emulated mode' currently do not have priority for us, since currently we are looking for other possibilities for layouting (bug 440098) instead of putting more effort into the GEF Layout component.
Comment 14 Ed Willink CLA 2018-11-30 12:24:17 EST
Ok. Thanks, but with so many deficiencies I would have thought this bug would just morph into 'complete nested sub-graph development'.