2architecture.tex 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. \section{Assumptions}\label{sec:assumptions}
  2. The following assumptions are made for the implementation of the node placement algorithm:
  3. \begin{itemize}
  4. \item There are no hyperedges.
  5. \item There are no port constraints.
  6. \item There are no labels.
  7. \item There are no cross-hierarchy edges.
  8. \item No edges over multiple layers (the previous phases should have added dummy nodes).
  9. \item Graphs are connected (maybe we will get rid of this assumption later, see~\ref{ch:progress}).
  10. \end{itemize}
  11. \section{Input File Format}\label{sec:inputFileFormat}
  12. The input to \appname is a JSON file.
  13. An example is displayed in figure~\ref{fig:json-example}.
  14. The structure is as follows:
  15. \begin{itemize}
  16. \item The object in the JSON file is a node.
  17. \item A node has the attributes that are displayed in table~\ref{table:node-attributes}.
  18. \item An edge has the attributes that are displayed in table~\ref{table:edge-attributes}.
  19. \end{itemize}
  20. For parsing the JSON file the JSON-java library~\cite{leary_json-java:_2018} is used.
  21. The classes for reading and writing those JSON files are displayed in figure~\ref{fig:io}.
  22. The internal representation of graphs is further explained in the section~\ref{sec:model}.
  23. \centering
  24. \begin{longtable}{|p{1.8cm}|p{2.3cm}|p{1.7cm}|p{8.5cm}|}
  25. \hline
  26. Attribute & Type & Optional & Explanation \\\hline\hline
  27. name & string & yes & If not omitted, this must be unique for a given parent node. \\\hline
  28. width & integer & yes & The minimum width of the node.
  29. The node can be wider if it contains other nodes that need more space. \\\hline
  30. height & integer & yes & The minimum height of the node.
  31. The node can be higher if it contains other nodes that need more space. \\\hline
  32. layers & list of lists of nodes & yes & The layers of nodes inside this node (Hierarchy). \\\hline
  33. edges & list of edges & yes & The edges between nodes whose parent node is this node. \\\hline
  34. \caption{Node Attributes}
  35. \label{table:node-attributes}
  36. \end{longtable}
  37. \begin{figure}[tp]
  38. \centering
  39. \includegraphics[width=\linewidth, trim={0 20cm 0 0}]{img/IO.pdf}
  40. \caption[Class diagram of the \enquote{IO} package]{Class diagram of the \enquote{IO} package, containing utilities for reading and writing graphs.}
  41. \label{fig:io}
  42. \end{figure}
  43. \newpage
  44. \TODO{attribute for dummy nodes}
  45. \begin{longtable}{|p{1.8cm}|p{2cm}|p{1.8cm}|p{8.5cm}|}
  46. \hline
  47. Attribute & Type & Optional & Explanation \\\hline\hline
  48. source & string & no & The name of the source of this edge.
  49. Must be a node with the same parent node as the node specified by the \enquote{target} attribute. \\\hline
  50. target & string & no & The name of the target of this edge.
  51. Must be a node with the same parent node as the node specified by the \enquote{source} attribute. \\\hline
  52. \caption{Edge Attributes}
  53. \label{table:edge-attributes}
  54. \end{longtable}
  55. \raggedright
  56. %\begin{figure}[tp]
  57. % \centering
  58. % \includegraphics[width=0.9\textwidth]{img/json.png}
  59. % \caption[Input file format]{Input file format illustrated as a HERM diagram}
  60. % \label{fig:iff}
  61. %\end{figure}
  62. \TODO{Kante in beispielJSON}
  63. \begin{figure}
  64. \begin{lstinputlisting}[language=json,emph={}]{img/graph.json}
  65. \end{lstinputlisting}
  66. \caption[Example Input File]{Example Input file that is understood by \appname.}
  67. \label{fig:json-example}
  68. \end{figure}
  69. \section{Internal graph representation, \enquote{Model}}\label{sec:model}
  70. One feature that is important to us, is to be able to work with hierarchical graphs (cf.\ chapter~\ref{ch:progress}).
  71. Therefore a node not only has edges to other nodes, but also it can contain other nodes and edges.
  72. So far this is similar to what we described in section~\ref{sec:inputFileFormat}.
  73. Additionally, there are multiple attributes that are used during the computation or as output variables.
  74. \begin{itemize}
  75. \item The attributes \enquote{shift}, \enquote{sink}, \enquote{root} and \enquote{align} correspond to the variables used by Brandes and Köpf~\cite{brandes_fast_2001}.
  76. They are summarized in table~\ref{table:bk-variables}.
  77. \item The \enquote{parent} of a node is the node that contains it in the hierarchy.
  78. \item The attributes $x$ and $y$ are the coordinates of the node relative to its parent node.
  79. \end{itemize}
  80. Similarly, edges have additional attributes:
  81. \begin{itemize}
  82. \item \enquote{dummy} specifies whether they are dummy edges.
  83. \item \enquote{conflicted} corresponds to the variable used by Brandes and Köpf~\cite{brandes_fast_2001} and indicates that this edge won't be drawn vertically.
  84. \item \enquote{bindPoints} is a list of bend points for the edge, including the beginning and end point of the edge.
  85. \end{itemize}
  86. A class diagram of the package \enquote{Model} is displayed in figure~\ref{fig:model}.
  87. \begin{figure}[tp]
  88. \centering
  89. \includegraphics[width=\linewidth, trim={0 6cm 0 0}]{img/Model.pdf}
  90. \caption{Class diagram of the \enquote{Model} package.}
  91. \label{fig:model}
  92. \end{figure}
  93. \begin{longtable}{|p{2.8cm}|p{10cm}|}
  94. \hline
  95. Attribute & Explanation \\\hline\hline
  96. root & The root node of the block of this node.
  97. Unique for all nodes in the same block. \\\hline
  98. sink & The topmost sink in the block graph that can be reached from the block that this node belongs to.
  99. Only used for nodes that are the root of a block.
  100. Unique for all nodes in the same class. \\\hline
  101. shift & The shift of the class that this node belongs to.
  102. Only used for nodes that are a sink of a class. \\\hline
  103. \caption{Variables also used by Brandes and Köpf~\cite{brandes_fast_2001}}
  104. \label{table:bk-variables}
  105. \end{longtable}
  106. \section{The actual algorithm}\label{sec:theActualAlgorithm}
  107. This section assumes that the reader is familiar with the node placement algorithm by Brandes and Köpf~\cite{brandes_fast_2001}.
  108. A \enquote{stage} of the algorithm, interface \enquote{AlgorithmStage}, is an interval during which each step of the algorithm is performed in a similar way.
  109. Each time such a step is performed it returns whether the stage is already finished.
  110. For example, a forward step in the stage of calculating one extremal layout, class \enquote{ExtremalLayoutCalc}, consists of either a step of calculating the blocks, class \enquote{BlockCalc}, or a step of compacting the layout, class \enquote{Compaction}.
  111. All the stages are displayed in class diagram~\ref{fig:animated}.
  112. To be able to undo a step each stage needs to implement methods for both forward and backward steps.
  113. \begin{figure}[tp]
  114. \centering
  115. \includegraphics[width=\linewidth, trim={0 9cm 0 0}]{img/Algorithms_Animated.pdf}
  116. \caption{Class diagram of the package \enquote{Algorithms.Animated}.}
  117. \label{fig:animated}
  118. \end{figure}
  119. \section{View}\label{sec:view}
  120. This section only covers the software architecture regarding the views.
  121. For an explanation of what is actually displayed, see chapter~\ref{ch:ui}
  122. \TODO{Kolja ausfragen}