# Wiki source code of Graph Analysis (GrAna)

Last modified by Richard Kreissig on 2023/09/14 10:38
Export
Office Formats
Export as PDF Export as ODT Export as RTF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

Hide last authors

author | version | line-number | content
--- | --- | --- | ---
| 9.1 | 1 | == Project Overview ==
| 1.1 | 2 | Related Theses:
|  | 3 |
|  | 4 | * Martin Rieß, //A Graph Editor for Algorithm Engineering//, September 2010 ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/theses/mri-bt.pdf||shape="rect"]])
|  | 5 |
| 7.1 | 6 | The Graph Analysis (GrAna) project allows to examine a broad variety of structural properties of a graph (node count, edge count, etc.) as well as properties of the final drawing (area, edge crossings, etc.). An analysis can either be performed on a single graph or batch-like on large collections of graphs, in which case the results are written to a file. We support a variety of input formats, namely every format our formats service knows about.
| 1.1 | 7 |
| 3.1 | 8 |
|  | 9 |
|  | 10 | {{toc/}}
|  | 11 |
| 9.1 | 12 | {{info}}
| 4.1 | 13 | A word of warning. Please scrutinize any results you get from GrAna. A lot of the existing analyses were written with certain graphs structures and use cases in mind. For instance, if the analysis does not account for self loops but your graph contains them, the results might be wrong.
| 9.1 | 14 | {{/info}}
| 4.1 | 15 |
| 1.1 | 16 | = Single Graphs Within the Editor =
|  | 17 |
| 9.1 | 18 | Within Eclipse we provide a //Graph Analysis// view, which can be found via Eclipse's //Windows->Show View->Others// dialog.
| 1.1 | 19 | In the top right corner of this view you can find two buttons, one of which performs the analysis on the lastly selected diagram. The other button allows you to configure the analysis, i.e. select specific analyses to perform. The following screenshot shows an example. On the very left it can be seen that the analysis was configured to list the node and edge count, the area, and the number of edge crossings. According to the results, the graph contains 4 nodes and 5 edges. This is correct because the //hyperedge// between nodes N2, N3, and N4 is structurally composed out of two edges and just drawn as a single edge. Counting hyperedges could be a different analysis. Moreover, the area is reported as 25800 and 0 edge crossings are present.
| 7.1 | 20 |
|  | 21 |
| 1.1 | 22 | [[image:attach:granaSingle.jpg]]
|  | 23 |
|  | 24 | = Batch Executions =
|  | 25 |
|  | 26 | A frequent use case is to analyze a large set of graphs with regards to some metric. For instance, you finished your awesome new algorithm to minimize the number of edge crossings in a graph and want to know how well it performs. The web offers large sets of graphs that already served as benchmarks in the past. GrAna allows batch analyses to be executed in two ways, textually and using an Eclipse Wizard.
|  | 27 |
|  | 28 | == Textually ==
|  | 29 |
|  | 30 | We provide a concise DSL to specify the sets of graphs, the layout algorithm and options, and the analyses textually and store them in a //.grana// file. The DSL is based on Xtext, hence the editor comes with syntax highlighting, content assist, and formatting. An example specification can be found below.
|  | 31 |
|  | 32 | You can specify a list of {{code language="none"}}Job{{/code}}s. A job is a self-contained unit of work. It specifies the previously mentioned data using the following keywords: {{code language="none"}}resources{{/code}}, {{code language="none"}}layoutoptions{{/code}}, {{code language="none"}}analyses{{/code}}, and {{code language="none"}}output{{/code}}. Layout options are specified by blocks that start with an arbitrary identifier followed by curly brackets. It is possible to specify multiple blocks of layout options. Each block results in a separate layout run allowing, for instance, to first execute a node placement algorithm and then an edge routing algorithm. For convenience it is possible to specify resources and output files globally at the beginning of the file and then use the {{code language="none"}}ref{{/code}} keyword to reference them from a job.
|  | 33 |
| 6.1 | 34 | Besides jobs, there are also {{code language="none"}}RangeJobs and CompareJobs.{{/code}} A RangeJob can be used to analyze the effect of a specific layout option onto a specific metric. In the example below, the //thoroughness// layout option is registered using the {{code language="none"}}rangeoption{{/code}} keyword. An integer range is specified resulting in all values between (inclusive) 1 and 50 being tested. While the analyses specified using the {{code language="none"}}analyses{{/code}} keyword are only measured on the initial graph, the analysis specified using the {{code language="none"}}rangeanalysis{{/code}} keyword will be measured for every tested value of the range layout option. Since analyses can be composed out of multiple components (e.g. the edge crossing analysis states the minimum, maximum, and average number of crossings per edge as well as the sum – four components), the {{code language="none"}}component{{/code}} keyword tells GrAna which component to write to the output file. The CompareJob can apply two different layouts to a graph and compare the results (the graph is copied internally so the layouts do not influence each other). The two layouts are specified via two layout blocks as shown in the avg_distance example below. This kind of job can be used to analyze the effect of a layout on the individual nodes (e.g. the distance nodes are moved).
| 5.1 | 35 |
| 1.1 | 36 | To execute GrAna based on a //.grana// file, right click the file and select //Execute Analysis Batch ...//
|  | 37 |
|  | 38 | {{code language="java"}}
|  | 39 | globalResources
|  | 40 | random "/Test/random/" filter ".*kgx"
|  | 41 | north_graphs "file://D:/graphs/north" filter ".*graphml"
|  | 42 | secret "/Test/secret/" filter ".*json"
|  | 43 |
|  | 44 | globalOutputs
|  | 45 | original_alg "/Test/results/original.csv"
|  | 46 | awesome_alg "file://workspaces/eclps/Test/results/new.csv"
| 9.1 | 47 | thoroughness "/Test/results/thorough.csv"
|  | 48 | compare "/Test/results/compare.csv"
| 1.1 | 49 |
|  | 50 | execute all
|  | 51 |
|  | 52 | job original
|  | 53 | layoutBeforeAnalysis
|  | 54 | resources
|  | 55 | ref random
|  | 56 | ref north_graphs
|  | 57 | ref secret
|  | 58 | layoutoptions
|  | 59 | klay {
|  | 60 | de.cau.cs.kieler.algorithm: de.cau.cs.kieler.klay.layered
|  | 61 | de.cau.cs.kieler.klay.layered.crossMin: LAYER_SWEEP
|  | 62 | }
|  | 63 | analyses
|  | 64 | de.cau.cs.kieler.kiml.grana.nodeCount
|  | 65 | de.cau.cs.kieler.kiml.grana.edgeCrossings
|  | 66 | output ref original_alg
|  | 67 |
|  | 68 | job my_awesome
|  | 69 | layoutBeforeAnalysis
|  | 70 | resources
|  | 71 | ref random
|  | 72 | ref north_graphs
|  | 73 | ref secret
|  | 74 | layoutoptions
|  | 75 | klay {
|  | 76 | de.cau.cs.kieler.algorithm: de.cau.cs.kieler.klay.layered
|  | 77 | de.cau.cs.kieler.klay.layered.crossMin: LAYER_SWEEP
|  | 78 | de.cau.cs.kieler.klay.layered.crossMin.awesome: true
|  | 79 | }
|  | 80 | analyses
|  | 81 | de.cau.cs.kieler.kiml.grana.nodeCount
|  | 82 | de.cau.cs.kieler.kiml.grana.edgeCrossings
|  | 83 | output ref awesome_alg
| 5.1 | 84 |
|  | 85 | rangejob thoroughness
|  | 86 | resources
|  | 87 | ref random
|  | 88 | layoutoptions
|  | 89 | klay {
|  | 90 | de.cau.cs.kieler.algorithm: de.cau.cs.kieler.klay.layered
|  | 91 | de.cau.cs.kieler.klay.layered.crossMin: LAYER_SWEEP
|  | 92 | }
|  | 93 | analyses
|  | 94 | de.cau.cs.kieler.kiml.grana.nodeCount
|  | 95 | rangeoption
|  | 96 | de.cau.cs.kieler.klay.layered.thoroughness
|  | 97 | intrange 1 to 50
|  | 98 | // floatvalues 0.3, 0.4, 0.5
|  | 99 | rangeanalysis
|  | 100 | de.cau.cs.kieler.kiml.grana.edgeCrossings
|  | 101 | component 3
|  | 102 | output ref thoroughness
| 6.1 | 103 |
|  | 104 | comparejob avg_distance
|  | 105 | resources
|  | 106 | ref random
|  | 107 | layoutoptions
|  | 108 | l1 {
|  | 109 | algorithm: fixed
|  | 110 | }
|  | 111 | l2 {
|  | 112 | algorithm: layered
|  | 113 | }
|  | 114 | analyses
|  | 115 | de.cau.cs.kieler.grana.compare.averageDistance
|  | 116 | output ref compare
| 1.1 | 117 | {{/code}}
|  | 118 |
|  | 119 | == Eclipse Wizard ==
|  | 120 |
|  | 121 | Second, you can use an Eclipse //Wizard// to select one or more sets of graphs, specify and configure a layout algorithm, and select a set of analyses. Results are then written to a //.csv// file (or more precisely semicolon-separated-file).
|  | 122 | The following series of screenshots illustrates the process of using the wizard.
|  | 123 | [[image:attach:granaWizard.jpg]]
| 9.1 | 124 |
| 1.1 | 125 |
| 3.1 | 126 | = Required Plugins =
|  | 127 |
|  | 128 | * (((
|  | 129 | Core:
|  | 130 |
| 9.1 | 131 | *
| 3.1 | 132 |
|  | 133 | {{code language="none"}}
| 7.1 | 134 | de.cau.cs.kieler.grana
| 3.1 | 135 | {{/code}}
|  | 136 | )))
|  | 137 | * Textual DSL:
| 7.1 | 138 | ** {{code language="none"}}de.cau.cs.kieler.config.text{{/code}}
|  | 139 | ** {{code language="none"}}de.cau.cs.kieler.config.text.ide{{/code}}
|  | 140 | ** {{code language="none"}}de.cau.cs.kieler.config.text.ui{{/code}}
|  | 141 | ** {{code language="none"}}de.cau.cs.kieler.grana.text{{/code}}
|  | 142 | ** {{code language="none"}}de.cau.cs.kieler.grana.text.ide{{/code}}
|  | 143 | ** {{code language="none"}}de.cau.cs.kieler.grana.text.ui{{/code}}

# Quick Links

KIELER on GitHub
RTSYS Homepage

XWiki 14.4.7