Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling and Simulation NETW 707

Similar presentations


Presentation on theme: "Modeling and Simulation NETW 707"— Presentation transcript:

1 Modeling and Simulation NETW 707
Lecture 9 Network & Topology Modeling Course Instructor: Dr.-Ing. Maggie Mashaly C3.220

2 Examples of relevant Networks
Sensor Networks The Internet Social Networks

3 Graph Theory Begun in 1735 Bridges of Königsberg (today’s Kaliningrad): walk all 7 bridges without crossing a bridge twice B1 B2 B3 B4 B5 B6 B7 LC LB LA LD 3 Edges 5 Edges B A C D 1 2 3 4 6 7 5 Solved by: Parity of Nodes Replace each land mass with an abstract vertex or node Replace each bridge with an edge

4 Network Modeling using Graph Theory
Networks can be represented by graphs Router/Switch nodes modeled as vertices Communication links modeled as edges Vertices Edges

5 Basic Concepts/Definitions
Graph – A Graph is defined as a set of: V = Nodes (vertices) E = Edges (links, arcs) between pairs of nodes Denoted by G = (V, E). Graph Size Parameters: Order of G : number of vertices, n = |V| Size of G : number of edges, m = |E| The running time of algorithms are usually measured in terms of the order and size of a graph

6 Directed Graph An edge e  E of a directed graph is represented as an ordered pair (u,v), where u, v  V u is the initial vertex v is the terminal vertex. u ≠ v 2 3 1 4 V = {1, 2, 3, 4}, |V | = 4 E = {(1,2), (2,3), (2,4), (4,1), (4,2)}, |E | = 5

7 Undirected Graph An edge e  E of an undirected graph is represented as an unordered pair (u,v) = (v,u), where u, v  V, u ≠ v 2 3 1 4 V = {1, 2, 3, 4}, |V | = 4 E = {(1,2), (2,3), (2,4), (4,1)}, |E |=4

8 Degree of a Vertex In an undirected graph Degree of a vertex is the number of edges incident on it. In a directed graph, the out degree of a vertex is the number of edges leaving it and the in degree is the number of edges entering it. 2 4 3 1 2 4 3 1 The degree of vertex 2 is 3 The in degree of vertex 2 is 2 and the out degree of vertex 3 is 0

9 Adjacent/Neighbor Nodes
If edge e={u,v} ∈ E, u and v are adjacent or neighbors 2 3 1 4 (1,2), (2,3), (2,4), (4,1) are all Adjacent/Neighbor Nodes

10 Weighted Graph A weighted graph is a graph for which each edge has an associated weight 2 4 3 1 5 2 4 3 1 8 6 9

11 Walks and Paths 3 V2 V3 1 2 3 V1 1 V6 4 4 V4 V5 1 A walk is an sequence of nodes (v1, v2,..., vL) such that {(v1, v2), (v2, v3),..., (vL-1, vL)} E, e.g. (V2, V3,V6, V5,V3) A simple path is a walk with no repeated nodes, e.g. (V1, V4,V5, V2,V3) A cycle is a walk (v1, v2,..., vL) where v1=vL with no other nodes repeated and L>3, e.g. (V1, V2,V5, V4,V1) A graph is called cyclic if it contains a cycle; otherwise it is called acyclic

12 Complete Graphs A complete graph is an undirected/directed graph in which every pair of vertices is adjacent. A A B B C C D 4 nodes and (4 × 3)/2 edges V nodes andV × (V-1)/2 edges 3 nodes and 3 × 2 edges V nodes and V × (V-1) edges

13 Connected Graph An undirected graph is connected if you can get from any node to any other by following a sequence of edges OR any two nodes are connected by a path A directed graph is strongly connected if there is a directed path from any node to any other node A graph is sparse if | E |  | V | A graph is dense if | E |  | V |2 A D E F B C A B C D

14 Bipartite Graph A bipartite graph is an undirected graph G = (V,E )
in which V can be partitioned into 2 sets V1 and V2 such that (u,v)  E implies u  V1 and v  V2 or vice versa V1 V2 v11 v21 v12 v22 v13 v23 v14

15 Trees An undirected graph is a tree if it is connected and does not contain a cycle. For an undirected tree Graph G, the following statements are equivalent: Any two vertices in G are connected by unique simple path G is connected, but if any edge is removed from E, the resulting graph is disconnected G is connected, and | E | = | V | -1 G is acyclic, and | E | = | V | -1 G is acyclic, but if any edge is added to E, the resulting graph contains a cycle A B C D E F

16 Spanning Tree G A tree (T ) is said to span G = (V,E ) if T = (V,E’ ) and E’ E There are usually several possible spanning trees V2 V3 V6 V1 V4 V5 Two example Spanning Trees of G V2 V5 V4 V3 V2 V1 V6 V3 V6 V1 V4 V5

17 Minimum Spanning Tree A Minimum Spanning Tree (MST) is a spanning tree of G whose sum of edge weights is minimized 1 3 8 2 6 7 4 5 23 10 21 14 16 18 9 11 24 1 3 8 2 6 7 4 5 9 11 G = (V, E ) T = (V, F ) w (T ) = 50 Cayley's Theorem (1889) There are nn-2 spanning trees of a complete graph Gn n = |V |, m = |E | Can't solve MST by exhaustive search (because of nn-2)

18 MST Computation Prim’s Algorithm:
Select an arbitrary node as the initial tree (T) Augment T in an iterative fashion by adding the outgoing edge (u,v), (i.e., u  T and v  G-T ) with minimum cost (i.e., weight) The algorithm stops after |V| - 1 iterations Computational complexity = O (|V|2)

19 Prim’s Algorithm (Example)
V2 3 V3 V1 V2 V3 1 Algorithm starts 2 3 V6 3 V2 V1 1 1 1 4 1 4 V1 V1 V4 V5 After the 1st iteration After the 2nd iteration V3 V3 V2 3 V2 3 V2 3 V3 1 1 1 2 3 1 1 1 V1 V1 V1 V6 1 1 V4 V4 V5 V5 V5 After the 3rd iteration After the 4th iteration After the 5th iteration

20 MST Computation Kruskal’s Algorithm:
Select the edge e  E of minimum weight → E’ = {e} Continue to add the edge e  E – E’ of minimum weight that when added to E’, does not form a cycle Computational complexity = O(|E|×log|E|)

21 Kruskal’s Algorithm (Example)
V2 3 V3 V2 V3 1 V2 2 1 1 3 1 V6 After the 1st iteration V1 V1 V1 1 4 1 4 V4 V2 V3 V4 V5 1 V5 V1 1 1 After the 3rd iteration After the 2nd iteration V5 V2 V3 V2 3 V3 1 1 2 2 1 1 V1 V1 V6 V6 1 1 V4 V5 V4 V5 After the 4th iteration After the 5th iteration

22 Shortest Path Spanning Tree
T, is a shortest path spanning tree Rooted at a particular node |V |-1 minimum weight paths from that node to each of the other network nodes is contained in T 2 4 3 1 6 5 Graph Minimum Spanning Tree Shortest Path Spanning Tree rooted at vertex 1

23 Shortest Path Algorithms
Dijkstra Bellman-Ford Algorithm Floyd-Warshall Algorithm

24 Graph Representation: Adjacency Matrix
is an n×n matrix with Auv = 1 if (u, v) is an edge Symmetric matrix for undirected graphs (not for directed graphs) Space: proportional to n2. Not efficient for sparse graphs Algorithms might have longer running time if this representation used Checking if (u, v) is an edge consumes O(1) time. Identifying all edges consumes O(n2) time.

25 Graph Representation: Adjacency List
is a Node-indexed array of lists Two representations of each edge Space proportional to m + n Checking if (u, v) is an edge consumes O(deg(u)) time Identifying all edges takes O(m+n) time Requires O(m+n) space. Good for dealing with sparse graphs

26 Graph Representation Adjacency Matrix Adjacency List 1 2 3 4 5 6 7 8 1
Adjacency Matrix 1 2 3 4 5 7 8 6 Adjacency List

27 Running Times of Algorithms
Analyzing an Algorithm over a Graph: Predicting resources (computational time and memory space ) required Running Time of an algorithm: the number of steps executed as a function of its input (for G, input is n=|V| and m=|E|) Order of Growth: consider only the leading term of the running time, since lower-order terms are relatively insignificant for large n E.g., O(an2 + bn + c) is O(n2) An algorithm is efficient if its running time is low order polynomial (quadratic)

28 References NETW 707 Lectures slides by A. Prof. Tallal El-Shabrawy, 2016 & 2017 “Simulation Modeling and Analysis” by Averill M. Law, 5th Edition, 2015


Download ppt "Modeling and Simulation NETW 707"

Similar presentations


Ads by Google