16 how to structure large models and programs with graph
play

16. How to Structure Large Models and Programs with Graph - PowerPoint PPT Presentation

Fakultt Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie Prof. Amann - Softwaretechnologie II 16. How to Structure Large Models and Programs with Graph Structurings 1. TopSorting (Layering) Prof. Dr. U.


  1. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 16. How to Structure Large Models and Programs – with Graph Structurings 1. TopSorting (Layering) Prof. Dr. U. Aßmann 2. Strongly Connected Technische Universität Dresden Institut für Software- und Components Multimediatechnik 3. Reducibility Gruppe Softwaretechnologie 4. Summary of Structurings http://st.inf.tu- dresden.de/teaching/swt2 2016-0.1, 17.12.16 Prof. U. Aßmann 1

  2. Obligatory Reading Softwaretechnologie II 2 Ø Jazayeri Chap 3. If you have other books, read the lecture slides carefully and do the exercise sheets Ø Roberto Bruni, Alberto Lluch Lafuente. Ten Virtues of Structured Graphs. ECEASST Vol 18 (2008) • http://journal.ub.tu-berlin.de/eceasst/article/view/261/246 Ø F. Klar, A. Königs, A. Schürr: "Model Transformation in the Large", 6th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering, New York, ACM Press, 2007; ACM Digital Library Proceedings, 285-294. Ø http://www.idt.mdh.se/esec-fse-2007/ Ø Tom Mens, Pieter Van Gorp. A Taxonomy of Model Transformation. Electronic Notes in Theoretical Computer Science 152 (2006) 125–142, doi:10.1016/j.entcs.2005.10.021 Ø T. Fischer, Jörg Niere, L. Torunski, and Albert Zündorf, 'Story Diagrams: A new Graph Rewrite Language based on the Unified Modeling Language', in Proc. of the 6th International Workshop on Theory and Application of Graph Transformation (TAGT), Paderborn, Germany (G. Engels and G. Rozenberg, eds.), LNCS 1764, pp. 296--309, Springer Verlag, November 1998. http://www.upb.de/cs/ag- schaefer/Veroeffentlichungen/Quellen/Papers/1998/TAGT1998.pdf Prof. U. Aßmann

  3. Reducibility Softwaretechnologie II 3 [Tarjan74] Robert E. Tarjan. Testing flow graph reducibility. Journal Ø Computer System Science, 9:355-365, 1974. [ASU86] Alfred A. Aho, R. Sethi, and Jeffrey D. Ullman. Compilers: Ø Principles, Techniques, and Tools. Addison-Wesley, 1986. [JC97] Johan Janssen and Henk Corporaal. Making graphs reducible with Ø controlled node splitting. ACM Transactions on Programming Languages and Systems (TOPLAS), 19(6):1031-1053, November 1997. Prof. U. Aßmann

  4. Further Reading Softwaretechnologie II 4 Ø Tom Mens. On the Use of Graph Transformations for Model Refactorings. In GTTSE 2005, Springer, LNCS 4143 • http://www.springerlink.com/content/5742246115107431/ Ø Reducible graphs Ø [ASU86] Alfred A. Aho, R. Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986. Ø Structured programming and stepwise refinement was started with Dijkstra’s famous letter to CACM about goto’s: Ø E. W. Dijkstra. GoTo Considered Harmful. Communications of the ACM. Volume 11 Issue 3, March 1968. Pages 147-148. http://dl.acm.org/citation.cfm?doid=362929.362947 Ø Search for these keywords at Ø http://scholar.google.com Ø http://citeseer.ist.psu.edu Ø http://portal.acm.org/guide.cfm Ø http://ieeexplore.ieee.org/ Ø http://www.gi-ev.de/wissenschaft/digitbibl/index.html Prof. U. Aßmann Ø http://www.springer.com/computer?SGWID=1-146-0-0-0

  5. Softwaretechnologie II 5 Prof. U. Aßmann

  6. The Problem: How to Master Large Models Softwaretechnologie II 6 Large models have large graphs Ø Ø They can be hard to understand Ø Figures taken from Goose Reengineering Tool, analysing a Java class system [Goose, FZI Karlsruhe] Prof. U. Aßmann

  7. Answer: Simon's Law of Complexity Softwaretechnologie II 7 Ø H. Simon. The Architecture of Complexity. Proc. American Philosophical Society 106 (1962), 467-482. Reprinted in: Ø H. Simon, The Sciences of the Artificial. MIT Press. Cambridge, MA, 1969. Hierarchical structure reduces complexity. Herbert A. Simon, 1962 Remember, structuring is a basic engineering activity Prof. U. Aßmann

  8. Idea of Structurings Softwaretechnologie II 8 If a graph-based model is too complex, try structurings Ø Ø Structurings overlay graphs with skeleton lists, trees, and dags Ø Structuring can be achieved with graph analysis, logic-based analysis, and graph rewriting Ø Example: finding a spanning tree: root root root root ....... ....... ....... Prof. U. Aßmann ....... ....... ....... sinks sinks

  9. Idea of Structurings Softwaretechnologie II 9 Structuring allow for subsequently following the structure Ø Ø Sequential algorithms can be applied Ø Recursive algorithm schemas can be applied Ø Wavefronts can be applied Ø Structures are nice for thinking and abstraction (see Simon’s law) Ø In particular in analysis and design Ø Structurings prepare further refactorings Ø The structural information can be exploited to further transform the code and to prove preservation of semantics Ø Structurings need Ø Logics with types (e.g., F-Datalog) Ø Graph reachability analysis Ø Graph transformation Prof. U. Aßmann

  10. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 16.1 Topologic Sorting of DAGs (Layering) Overlaying a list on a dag 10 Prof. U. Aßmann

  11. Topologic Sorting on Dags Softwaretechnologie II 11 If constraints for the partial order of some things are given, but no total Ø order Ø It doesn’t matter in which order some things are executed Ø May be even in parallel Ø There are many “legal” orderings, the topological sortings (topsorts, Totalordnung) ....... ....... Prof. U. Aßmann .......

  12. Partial Order for Car Departure Softwaretechnologie II 12 open right door close right door open left door drive close left door Prof. U. Aßmann

  13. Topological Sorts on Car Departure Softwaretechnologie II 13 2 3 open right door close right door 1 5 open left door 4 drive close left door Prof. U. Aßmann

  14. Topological Sorts on Car Departure Softwaretechnologie II 14 1 open right door close right door 4 open left door 3 drive 2 5 close left door Prof. U. Aßmann

  15. Topological Sorting a Directed Acyclic Graph Softwaretechnologie II 15 Ø Topological sorting sorts the nodes with the „least many ancestors“ first Ø TopSort can be described by a subtractive graph rewrite system (SGRS) TopSort-R1: Numbering entry nodes with fan-in 0 0 0 A A depth := gdepth gdepth := gdepth+1 TopSort-R2: Contraction: Remove entry nodes with fan-in 0 1 0 B B A:depth Prof. U. Aßmann http://de.wikipedia.org/wiki/Topologische_Sortierung

  16. Topological Sorts on Car Departure Softwaretechnologie II 16 close door Open door close door Drive Open door close door Drive close door R1, R1 R2, R2 R1 close door 2 Open door 0 close door Drive 4 close door 3 Open door 1 Prof. U. Aßmann Drive close door ETC…

  17. Results: Topological Sortings Softwaretechnologie II 17 The derivations of the GRS TopSort result in different topological sortings Ø of the dag. For instance: Ø Open door close door Open door Drive close door Prof. U. Aßmann

  18. Benefit of TopSorts Softwaretechnologie II 18 Ø TopSorted dags are simpler Ø Because they structure partial orderings Ø Removing parallelism and indeterminism Ø Question: why are all cooking recipes sequential? Prof. U. Aßmann

  19. Applications of TopSort Softwaretechnologie II 19 Ø Serialization of data structures from the heap Ø Compute a topsort and flatten all objects in the order of the topsort Ø Package trees Ø Systems with big package trees can be topsorted and then handled in this order for differenzing between versions (regression tests) Ø UML activity diagrams Ø Finding a sequential execution order Ø Project management: (see course “Softwaremanagement”) Ø Task scheduling for task graphs (milestone plans): who does when what? Ø Find a topsort for the construction of your next house! Ø Execution of parallel processes (sequentialization of a parallel application) Ø Execute the processes according to dependencies of a topsort Ø Task scheduling Ø Find sequential execution order for parallel (partially ordered) activities Prof. U. Aßmann

  20. Softwaretechnologie II 20 ....... ....... ....... How to make an arbitrary relationship acyclic: overlaying a graph with a dag 16.2 STRONGLY CONNECTED COMPONENTS 20 Prof. U. Aßmann

  21. Strongly Connected Components (Acyclic Condensation) Softwaretechnologie II 21 Ø The acyclic condensation (AC) asks for mutual reachability of nodes, hence for the effect of cycles in graphs Ø A digraph is strongly connected , if every node is reachable from another one Ø A subgraph of a graph is a strongly connected component (SCC) Ø If every of its nodes is strongly connected Ø The reachability relation is symmetric Ø All edges on a cycle belong to the same SCC Ø How to compute reachability: Ø Declaratively: Specification with an EARS or recursive Datalog: sameSCC(X,Y) :- reachable(X,Y), reachable(Y,X). Prof. U. Aßmann Ø Imperatively: Depth first search in O(n+e) Ø The AC has n strongly connected components

  22. The Result of the SCC Analysis: the Acyclic Condensation Softwaretechnologie II 22 The SCC of a graph form „abstract super-nodes“ Ø Ø This dag of super-nodes is called acyclic condensation (AC) SCC (super-nodes) Prof. U. Aßmann

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend