Changes for page KLay Layered
Last modified by Richard Kreissig on 2023/09/14 09:07
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 3 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,0 @@ 1 -KIELER.Tutorials.Diagrams and Layout.WebHome - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. als1 +XWiki.uru - Content
-
... ... @@ -1,109 +1,52 @@ 1 -In this tutorial you'll learn about the structure and philosoph yin our main layout algorithm [[doc:KIELER.KLay Layered]]. It is based on an idea that became known as //Sugiyama-style// layout, where the task to layout a graph is split into multiple subsequent steps with the goal to emphasize direction, i.e. let as many edges point into the same direction as possible.1 +In this tutorial you'll learn about the structure and philosophie in our main layout algorithm [[doc:KIELER.KLay Layered]]. It is based on an idea that became known as //Sugiyama-style// layout, where the task to layout a graph is split into multiple subsequent steps with the goal to emphasize direction, i.e. let as many edges point into the same direction as possible. 2 2 3 - =Preliminaries =3 + 4 4 5 - [[doc:Kieler.Tutorials.Other.InstallingEclipsefor Layout Development.WebHome]]5 += The Five Phases = 6 6 7 - {{excerpt-include/}}7 +explain 8 8 9 -= =Gettingthe SourceCode==9 += KLay Layered's Structure = 10 10 11 - Additionally, we need to get our handson the actualsourcecode of KLay Layered. You can find it in the //pragmatics//repository in our Stash.11 +class diagram? 12 12 13 -1. Clone the [[repository>>url:http://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/pragmatics/browse||shape="rect"]]. 14 -1. Import the {{code language="none"}}de.cau.cs.kieler.klay.layered{{/code}} plugin into your workspace. 13 +Intermediate processor 15 15 16 - =Getting to Know KLay Layered =15 + 17 17 18 -1. Familiarize yourself with the general idea and architecture of the layout algorithm by reading its [[documentation>>doc:KIELER.KLay Layered]]. You should know about terms like //dummy nodes//, //intermediate processors//, and //phases//. 19 -1. With this knowledge, browse the code and try to identify the packages and classes that relate to the phases of KLay Layered. 20 -1. Understand the differences between the {{code language="none"}}KGraph{{/code}} and {{code language="none"}}LGraph{{/code}} and explore how to use the {{code language="none"}}LGraph{{/code}}. As noted in KLay Layered's documentation the {{code language="none"}}LGraph{{/code}} is a lightweight version that is specifically tailored to serve as a data structure for layer-based layout. The following class diagram contains just about all the information you require for the assignment. 21 -[[image:attach:lgraph.png]] 17 += Preliminaries = 22 22 23 - = Assignment=19 +[[doc:Installing Eclipse for Layout Development]] 24 24 25 - Thegoal of this assignment is to write a very simple layering algorithm. As you probably already know,classically thelayeringphase (phase 2) expects theinput graph to be acyclic. Here however, youwill:21 +{{excerpt-include/}} 26 26 27 -1. Configure the layout algorithm to use a {{code language="none"}}NullPhase{{/code}} for cycle breaking, 28 -1. Layer the possibly cyclic graph in a fashion as you like, and 29 -1. Use an intermediate processor to reverse edges (if required) such that subsequent phases are guaranteed to work with an acyclic graph. 23 +== Getting the Source Code == 30 30 31 - Don't hesitate to switch between the tasks andon't be afraid of exceptionsorerrorsduring debugging. Whenyouuseyourlayering phasewithouttheintermediateprocessors therestof KLay Layeredwill mostlikelycomplain(for cyclicinputgraphs). Inotherwords,thefollowing two assignmentsonlywork combinedand notalone.25 +Additionally, we need to get our hands on the actual source code of KLay Layered. You can find it in the //pragmatics// repository in our Stash. 32 32 33 - {{paneltitle="Assignment(a)"}}34 - Createalayout phase27 +1. Check out the [[repository>>url:http://git.rtsys.informatik.uni-kiel.de/projects/KIELER/repos/pragmatics/browse||shape="rect"]]. 28 +1. Import the {{code language="none"}}de.cau.cs.kieler.klay.layered{{/code}} plugin into your workspace. 35 35 36 -{{code language="none"}} 37 -NullPhase 38 -{{/code}} 30 + 39 39 40 - that doesnothing and can be used as a cycle breakingstrategy. Hint: It has to implementthe32 += Assignment = 41 41 42 -{{code language="none"}} 43 -ILayoutPhase 44 -{{/code}} 34 +The goal of this assignment is to write a very simple layering algorithm. As you learnt earlier, classically the layering phase expects the input graph to be acyclic. Here however, you will configure the layout algorithm to use a {{code language="none"}}NullPhase{{/code}} for cycle breaking, layer the possibly cyclic graph in a fashion as you like, and use an intermediate processor to reverse edges (if required) such that subsequent phases are guaranteed to work with an acyclic graph. 45 45 46 - interface and has to be added to the 36 +{{panel title="Assignment (1)"}} 37 +Write an intermediate processor that takes a //layered// graph as input and reverses edges such that the output graph is acyclic. Here are some hints. 47 47 48 -{{code language="none"}} 49 -CycleBreakingStrategy 50 -{{/code}} 39 +The {{code language="none"}}LEdge{{/code}} offers a method {{code language="none"}}reverseEdge{{/code}} that does most of the job for you and marks the edge. The {{code language="none"}}EdgeReversalRestorer{{/code}} will take care of 'back'-reversing such edges at the end of the algorithm. Your class should extend the {{code language="none"}}ILayoutProcessor{{/code}} interface. 51 51 52 - enumeration.41 +CODE 53 53 {{/panel}} 54 54 55 -{{panel title="Assignment (b)"}} 56 -Write an intermediate processor that takes a //layered// graph (i.e. the result of assigment 2) as input and reverses edges such that the output graph is acyclic. Here are some hints. 57 - 58 -The {{code language="none"}}LEdge{{/code}} offers a method {{code language="none"}}reverseEdge{{/code}} that does parts of the job for you and marks the edge such that the {{code language="none"}}ReversedEdgeRestorer {{/code}}will take care of 'back'-reversing the edge at the end of the algorithm. Your class should extend the {{code language="none"}}ILayoutProcessor{{/code}} interface. 59 - 60 -{{code linenumbers="true" language="java"}} 61 -public class EdgeDirectionEnforcer implements ILayoutProcessor { 62 - @Override 63 - public void process(final LGraph layeredGraph, final IKielerProgressMonitor progressMonitor) { 64 - // for all edges ... 65 - if (...) { 66 - edge.reverse(layeredGraph, true); 67 - } 68 - } 69 -} 70 -{{/code}} 71 -{{/panel}} 72 - 73 -{{panel title="Assignment (c)"}} 44 +{{panel title="Assignment (2)"}} 74 74 Write a layer assignment algorithm that assigns nodes of a possibly cyclic input graph to layers. The only requirement is that you don't assign layers randomly. 75 75 76 -The intermediate processing configuration has to include your previously created intermediate processor as well as the e xisting {{code language="none"}}ReversedEdgeRestorer{{/code}}.The{{code language="none"}}IntermediateProcessorStrategy{{/code}}can help you to find the phase afterwhich toexecute the {{code language="none"}}ReversedEdgeRestorer{{/code}}.47 +The intermediate processing configuration has to include your previously created intermediate processor as well as the mentioned edge reverser. 77 77 78 - Take care not to place two nodes in the same layer if they are connected by an edge.49 +CODE 79 79 80 -{{code linenumbers="true" language="java"}} 81 -public class RandomLayerer implements ILayoutPhase { 82 - @Override 83 - public IntermediateProcessingConfiguration getIntermediateProcessingConfiguration(final LGraph graph) { 84 - return IntermediateProcessingConfiguration.createEmpty() 85 - [ ... ] // add your desired configuration here 86 - ; 87 - } 88 - 89 - @Override 90 - public void process(final LGraph layeredGraph, final IKielerProgressMonitor progressMonitor) { 91 - [ ... ] 92 - } 93 -} 94 -{{/code}} 95 -{{/panel}} 96 - 97 -{{tip}} 98 -Use {{code language="none"}}node.setLayer(layerX);{{/code}} to add assign a layer to a node. Internally, the node will be added to the layer's list of nodes. 99 - 100 -Don't forget to let the switch statements in the {{code language="none"}}LayeringStrategy{{/code}} and {{code language="none"}}IntermediateProcessorStrategy{{/code}} enumerations know about the new classes. 101 - 102 -The layout options you definitely need are {{code language="none"}}de.cau.cs.kieler.klay.layered.cycleBreaking{{/code}} and {{code language="none"}}de.cau.cs.kieler.klay.layered.nodePlace{{/code}}. 103 -{{/tip}} 104 - 105 -A result might look like this. The default strategies of KLay Layered try to achieve short edges and a low number of reversed edges. The left screenshot shows the result of a random layerer and is obviously inferior to the result seen in the right screenshot. 106 - 107 107 108 - 109 -[[image:attach:rand.jpg]][[image:attach:klay.jpg]] 52 +{{/panel}}
- klay.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.XWikiGuest - Size
-
... ... @@ -1,1 +1,0 @@ 1 -9.6 KB - Content
- lgraph.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.XWikiGuest - Size
-
... ... @@ -1,1 +1,0 @@ 1 -53.6 KB - Content
- rand.jpg
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.XWikiGuest - Size
-
... ... @@ -1,1 +1,0 @@ 1 -12.1 KB - Content
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -1075172 11 +10751723 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/TUT/pages/1075172 1/KLay Layered1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/TUT/pages/10751723/KLay Layered