Prechádzať zdrojové kódy

Merge branch 'master' of https://koljastrohm-games.com:3000/GraphDrawer/NodeShuffler

Kolja Strohm 6 rokov pred
rodič
commit
4cc84e4a71

+ 9 - 3
doc/chapter/2architecture.tex

@@ -6,19 +6,25 @@ The following assumptions are made for the implementation of the node placement
     \item There are no labels.
     \item There are no cross-hierarchy edges.
     \item No edges over multiple layers (the previous phases should have added dummy nodes).
-    \item Graphs are connected (maybe we will get rid of this assumption later, see chapter~\ref{ch:progress}).
+    \item Graphs are connected (see below).
 \end{itemize}
 
+Regarding the last assumption, we found an example where for a disconnected graph the algorithm behaved incorrectly.
+Maybe we will get rid of this assumption later, see chapter~\ref{ch:progress}.
+We are currently investigating another example, where the algorithm behaves incorrectly for a connected graph.
+These two examples are included in the appendix (figures~\ref{fig:error_disconnected_img},~\ref{fig:error_connected_img},~\ref{fig:error_disconnected}, and~\ref{fig:error_connected},).
+
 
 \section{Overview}\label{sec:components}
 The \code{main} package contains an executable class \code{Main}.
 This classes main method reads a graph from a file using the \code{graph.io} package and then creates a MainView.
+It is also possible to create a MainView directly from an \code{ElkNode}.
 The view then instantiates a \code{BKNodePlacement} algorithm and runs it.
 The \code{BKNodePlacement} repeatedly asks the \code{AnimationController} if a step should be done (this is further explained in section~\ref{sec:theActualAlgorithm}).
 It uses \code{LayeredGraphNode}s and \code{LayeredGraphEdge}s.
 Meanwhile the view displays the same \code{LayeredGraphNode}s and \code{LayeredGraphEdge}s on the screen.
 
-Figure~\ref{fig:components} contains a component diagram that illustrates these dependencies of the packages.
+Figure~\ref{fig:components} contains a component diagram that illustrates these dependencies of the different packages.
 
 \begin{figure}[htp]
     \centering
@@ -95,7 +101,7 @@ The internal representation of graphs is further explained in the section~\ref{s
 \begin{figure}
     \begin{lstinputlisting}[language=json,emph={}]{src/graph.json}
     \end{lstinputlisting}
-    \caption[Example Input File]{Example Input file that is understood by \appname.}
+    \caption[Example input file]{Example input file that is understood by \appname.}
     \label{fig:json-example}
 \end{figure}
 

+ 3 - 1
doc/chapter/3ui.tex

@@ -11,6 +11,7 @@ Figure~\ref{fig:originalpapergraph} compares our results to those of Brandes and
     \includegraphics[width=\linewidth]{img/skizze}
     \caption[First sketch of the planned layout]{A first sketch of the planned layout, created with Microsoft Paint.
     The buttons are (first row, from left to right): step over, step into, step out, run, pause, debug; and (second row, from left to right): step back over, step back into, step back out, run backwards, load graph, save graph, generate random graph.
+    Currently a button to open the preferences dialog is located in the second row at the empty position.
     The actions corresponding to the buttons are the same as described for the keyboard input in table~\ref{table:keys}, at least for the features that are already implemented (all of them).
     The left four rectangles show the progress of the four extremal layouts.
     The right rectangle shows pseudocode of the algorithm and the position of the current step.}
@@ -81,7 +82,8 @@ These can also be used by clicking on one of the buttons displayed in figures~\r
         Ensures that the generated graph is connected.\\\hline
         Alt + S & Save the current graph to a file (opens a dialog window). \\\hline
         Alt + L & Load a graph from a file (opens a dialog window). \\\hline
-        Alt + D & Show a debug table (opens window~\ref{fig:debug-table}). \\\hline
+        Alt + D & Show a debug table (opens window~\ref{fig:debug-table}) and also printlines its content. \\\hline
+        Alt + O & Opens the preferences dialog~\ref{fig:preferences}. \\\hline
         \caption[Overview of the available keyboard commands]{Overview of the available keyboard commands.
         The lazy user might not want to learn these by rote but instead use the buttons displayed in figures~\ref{fig:sketch} and~\ref{fig:full-application-example}.}
         \label{table:keys}

+ 5 - 2
doc/chapter/4progress.tex

@@ -25,16 +25,19 @@ The following features are either planned (\planned), under construction (\progr
         \item[\done] Drawing the conflicted edges in a different color.
         \item[\done] Drawing dummy nodes differently from other nodes.
         \item[\done] Drawing the four extremal layouts and the combined layout separately.
+        \begin{itemize}
+            \item[\done] Optionally, drawing the only the extremal layout the algorithm is currently working on.
+        \end{itemize}
         \item[\planned] Drawing the edges of the block graph (yet another color, low priority).
         \item[\done] Showing pseudocode and the position where the algorithm currently is.
-        \item[\planned] Add a legend to explain the shapes and colors.
         \begin{itemize}
             \item[\done] Clicking on the pseudocode to set a breakpoint at (not \reserved{goto}) a specific location.
         \end{itemize}
+        \item[\planned] Add a legend to explain the shapes and colors.
     \end{itemize}
     \item[\done] Running the algorithm step by step manually.
     \item[\done] Running the algorithm step by step with configurable delay (\enquote{automatic execution}).
-    \item[\planned] Running the algorithm only on the unfolded parts of the source code (\enquote{step overrun}).
+    \item[\done] Running the algorithm only on the unfolded parts of the source code (\enquote{step overrun}).
     \item[\done] Using debugger-like commands such as \enquote{step into}, \enquote{step over}, \enquote{step out}.
     \item[\done] Adding buttons and other graphical elements to support the user interface (low priority, see figure~\ref{fig:sketch}).
     Currently there is only keyboard input (cf.\ section~\ref{sec:userInterface}).

+ 42 - 2
doc/chapter/appendix.tex

@@ -28,7 +28,7 @@
 
 \begin{figure}[htp]
     \centering
-    \includegraphics{img/random-graph-dialog}
+    \includegraphics[width=0.33\linewidth]{img/random-graph-dialog}
     \caption[Random graph dialog]{Dialog for generating random graphs.}
     \label{fig:random-graph-dialog}
 \end{figure}
@@ -38,4 +38,44 @@
     \includegraphics[width=\linewidth]{img/debug-table}
     \caption[Debug Table]{An example for a debug table. The graph used is the same as in figure~\ref{fig:example}}
     \label{fig:debug-table}
-\end{figure}
+\end{figure}
+
+\begin{figure}[htp]
+    \centering
+    \includegraphics[width=0.33\linewidth]{img/preferences}
+    \caption[Preferences]{The dialog for adjusting the preferences.}
+    \label{fig:preferences}
+\end{figure}
+
+\begin{figure}[htp]
+    \centering
+    \includegraphics[width=0.33\linewidth]{img/error_disconnected}
+    \caption[Error caused by disconnected graph]{An illustration of the error caused by the graph displayed in figure~\ref{fig:error_disconnected}.
+    In the lowest layer the two nodes are drawn at the same position.}
+    \label{fig:error_disconnected_img}
+\end{figure}
+
+\begin{figure}[htp]
+    \centering
+    \includegraphics[width=0.33\linewidth]{img/error_connected}
+    \caption[Error caused by connected graph]{An illustration of the error caused by the graph displayed in figure~\ref{fig:error_connected}.
+    In the fourth layer the last two nodes are drawn at the same position.}
+    \label{fig:error_connected_img}
+\end{figure}
+
+\begin{figure}
+    \begin{lstinputlisting}[language=json,emph={},basicstyle=\scriptsize\ttfamily,numberstyle=\tiny]{src/error_disconnected.json}
+    \end{lstinputlisting}
+    \caption[Disconnected graph causing an error]{Example graph where the node placement algorithm does not behave correctly, possibly because it is not connected.
+    The error is illustrated in figure~\ref{fig:error_disconnected_img}.}
+    \label{fig:error_disconnected}
+\end{figure}
+
+\begin{figure}
+    \begin{lstinputlisting}[language=json,emph={},basicstyle=\tiny\ttfamily,numberstyle=\tiny]{src/error_connected.json}
+    \end{lstinputlisting}
+    \caption[Connected graph causing an error]{Example graph where the node placement algorithm does not behave correctly, even though it is connected.
+    We did not check yet if this is a problem with our implementation or with the node placement algorithm itself.
+    The error is illustrated in figure~\ref{fig:error_connected_img}.}
+    \label{fig:error_connected}
+\end{figure}

BIN
doc/img/error_connected.png


BIN
doc/img/error_disconnected.png


BIN
doc/img/preferences.png


+ 67 - 0
doc/src/error_connected.json

@@ -0,0 +1,67 @@
+{
+  "layers": [
+    [
+      { "name": "4" }
+    ],
+    [
+      { "name": "8" },
+      { "name": "9" }
+    ],
+    [
+      { "name": "11" }
+    ],
+    [
+      { "name": "16" },
+      { "name": "17" },
+      { "name": "18" },
+      { "name": "19" }
+    ],
+    [
+      { "name": "23" },
+      { "name": "24" }
+    ]
+  ],
+  "edges": [
+    {
+      "source": "4",
+      "target": "9"
+    },
+    {
+      "source": "4",
+      "target": "8"
+    },
+    {
+      "source": "8",
+      "target": "11"
+    },
+    {
+      "source": "11",
+      "target": "16"
+    },
+    {
+      "source": "11",
+      "target": "18"
+    },
+    {
+      "source": "18",
+      "target": "24"
+    },
+    {
+      "source": "19",
+      "target": "24"
+    },
+    {
+      "source": "17",
+      "target": "23"
+    },
+    {
+      "source": "16",
+      "target": "23"
+    },
+    {
+      "source": "18",
+      "target": "23"
+    }
+  ]
+}
+

+ 44 - 0
doc/src/error_disconnected.json

@@ -0,0 +1,44 @@
+{
+   "layers":[
+      [
+      { "name": "n0" },
+      { "name": "n1" },
+      { "name": "n2" }
+      ],
+      [
+      { "name": "n3" },
+      { "name": "n4" },
+      { "name": "n5" }
+      ],
+      [
+      { "name": "n6" },
+      { "name": "n7" }
+      ]
+   ],
+   "edges":[
+      {
+         "source":"n0",
+         "target":"n5"
+      },
+      {
+         "source":"n1",
+         "target":"n5"
+      },
+      {
+         "source":"n2",
+         "target":"n5"
+      },
+      {
+         "source":"n3",
+         "target":"n7"
+      },
+      {
+         "source":"n4",
+         "target":"n7"
+      },
+      {
+         "source":"n5",
+         "target":"n7"
+      }
+   ]
+}

+ 32 - 32
doc/src/graph.json

@@ -1,36 +1,36 @@
 {
-  "layers": [
-    [
+   "layers":[
+      [
+         {
+            "width":10,
+            "height":10
+         },
+         {
+            "name":"n1",
+            "width":10,
+            "height":10,
+            "layers":[
+               [
+                  {
+                     "name":"n2",
+                     "width":10,
+                     "height":10
+                  }
+               ]
+            ]
+         }
+      ],
+      [
+         {
+            "name":"n2"
+         }
+      ]
+   ],
+   "edges":[
       {
-        "width": 10,
-        "height": 10
-      },
-      {
-        "name": "n1",
-        "width": 10,
-        "height": 10,
-        "layers": [
-          [
-            {
-              "name": "n2",
-              "width": 10,
-              "height": 10
-            }
-          ]
-        ]
-      }
-    ],
-    [
-      {
-        "name": "n2"
+         "source":"n1",
+         "target":"n2"
       }
-    ]
-  ],
-  "edges": [
-    {
-      "source": "n1",
-      "target": "n2"
-    }
-  ],
-  "name": "n0"
+   ],
+   "name":"n0"
 }

+ 1 - 1
src/view/MainView.java

@@ -240,7 +240,7 @@ public class MainView {
         options = new NiceButton( "settings" );
         options.setLocation( 210, 60 );
         options.setMnemonic( KeyEvent.VK_O );
-        options.setToolTipText( "Show Options Dialog (alt + o)" );
+        options.setToolTipText( "Preferences (alt + o)" );
         options.addActionListener( new ActionListener() {
 
             @Override