Milda
March 06, 2020
78

Graph theory and software engineering it1

March 06, 2020

Transcript

2. PART 1: Basics a.k.a stuﬀ I should have learned in

the university but I wasn’t listening

5. ORIGINS • There should not be any uncrossed bridges •

Each bridge must not be crossed more than once.
6. ORIGINS • There should not be any uncrossed bridges •

Each bridge must not be crossed more than once.
7. ORIGINS • 4 lands, 7 bridges • There are an

odd number of bridges connected to each land • if you enter a land by crossing one bridge, you can always leave the land by crossing its second bridge. If third bridge appears, you won’t be able to leave a land.

the problem

the problem

12. ORIGINS Degree of a vertex, the number of edges incident

connected to the vertex.
13. ORIGINS An Euler path of a finite undirected graph G(V,

E) is a path such that every edge of G appears on it once. If G has an Euler path, then it is called an Euler graph.
14. ORIGINS Theorem. A finite undirected connected graph is an Euler

graph if and only if exactly two vertices are of odd degree or all vertices are of even degree. In the latter case, every Euler path of the graph is a circuit, and in the former case, none is.

20. Graph representation Adjacency list - each list describes the set

of neighbors of a vertex in the graph

22. Graph algorithms Any processing done with graphs can be called

“graph algorithm”

27. Dijkstra’s algorithm 1) Mark all nodes unvisited. Create a set

of all the unvisited nodes called the unvisited set. 2) Assign to every node a tentative distance value: set it to zero for our initial node and to infinity for all other nodes. Set the initial node as current. Graph algorithms
28. Dijkstra’s algorithm 1) Mark all nodes unvisited. Create a set

of all the unvisited nodes called the unvisited set. 2) Assign to every node a tentative distance value: set it to zero for our initial node and to infinity for all other nodes. Set the initial node as current. Graph algorithms
29. Dijkstra’s algorithm 3) For the current node, consider all of

its unvisited neighbors and calculate their tentative distances through the current node. Compare the newly calculated tentative distance to the current assigned value and assign the smaller one. Graph algorithms
30. Dijkstra’s algorithm 4) When we are done considering all of

the neighbors of the current node, mark the current node as visited and remove it from the unvisited set. A visited node will never be checked again. Graph algorithms
31. Dijkstra’s algorithm 5) If the destination node has been marked

visited (when planning a route between two speciﬁc nodes) or if the smallest tentative distance among the nodes in the unvisited set is inﬁnity (when planning a complete traversal; occurs when there is no connection between the initial node and remaining unvisited nodes), then stop. The algorithm has ﬁnished. 6) Otherwise, select the unvisited node that is marked with the smallest tentative distance, set it as the new “current node”, and go back to step 3. Graph algorithms
32. Dijkstra’s algorithm 5) If the destination node has been marked

visited (when planning a route between two speciﬁc nodes) or if the smallest tentative distance among the nodes in the unvisited set is inﬁnity (when planning a complete traversal; occurs when there is no connection between the initial node and remaining unvisited nodes), then stop. The algorithm has ﬁnished. 6) Otherwise, select the unvisited node that is marked with the smallest tentative distance, set it as the new “current node”, and go back to step 3. Graph algorithms
33. PART 2: Graphs are fun a.k.a stuﬀ I found interesting

but did not know how to structure into proper presentation
34. GT in Model based testing Model based testing is a

software testing technique where run time behavior of software under test is checked against predictions made by a model. A model is a description of a system's behavior.
35. MBT ▪ You create model of a SUT ▪ It’s

a simpliﬁed model ▪ It’s a state model deﬁning states and relationships between them ▪ From this model you can generate tests and execute them on SUT
36. GT in MBT ▪ Chinese postman problem solutions ▪ de

Bruijn sequences algorithm ▪ Random Walk algorithm
37. Graph coloring problem Given m colors, find a way of

coloring the vertices of a graph such that no two adjacent vertices are colored using same color.

▪ Sudoku

40. In compiler optimization, register allocation is the process of assigning

a large number of target program variables onto a small number of CPU registers.
41. Nodes in the graph represent live ranges (variables, temporaries, virtual/symbolic

registers) that are candidates for register allocation. Edges connect live ranges that interfere , i.e., live ranges that are simultaneously live at at least one program point. Register allocation then reduces to the graph coloring problem in which colors (registers) are assigned to the nodes such that two nodes connected by an edge do not receive the same color.