Non-Negative Matrices and Graphs MAA704

Non-Negative Matrices and Graphs MAA704

Non-negative matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity Non-negative matrices and graphs MAA704 and the adjacency matrix Distance Christopher Engstr¨om matrix Shortest path and Dijkstra's algorithm Degree matrix November 20, 2018 of a graph Markov chains 1 / 50 Non-negative MAA704 Applied Matrix Analysis matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity and the Todays lecture: adjacency matrix I Non-negative matrices and introduction to graph theory. Distance matrix I Connectivity and Irreducibility. Shortest path and Dijkstra's I The Laplacian matrix of a graph algorithm Degree matrix of a graph Markov chains 2 / 50 Non-negative Non-negative matrices matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity A non-negative matrix is a matrix A where all elements and the I adjacency ai;j ≥ 0. matrix Distance I A positive matrix is a matrix A where all elements ai;j > 0. matrix Remark. Be careful to distinguish between Shortest path I and Dijkstra's positive/non-negative matrices and positive algorithm > Degree matrix definite/semi-definite matrices (recall x Ax). of a graph Markov chains 3 / 50 Non-negative Non-negative matrices in Graph-theory matrices and graphs MAA704 A graph is a collection of vertices (nodes) and edges (links) Christopher such as the one below. Engstr¨om lecture 2 Connectivity and the adjacency B matrix Distance matrix Shortest path and Dijkstra's algorithm A C Degree matrix of a graph Markov chains D 4 / 50 Non-negative Non-negative matrices in Graph-theory matrices and graphs MAA704 Christopher Engstr¨om There are many types of graphs those we will work with are: lecture 2 I Simple graphs, where we only allow a single edge from Connectivity and the one vertex to another. adjacency matrix Undirected graphs, where edges do not have a direction I Distance so we are only interested in if there is a edge between two matrix Shortest path vertices. and Dijkstra's algorithm I Directed graphs, where edges do have a direction, a edge Degree matrix A ! B does not necessary mean there is a edge B ! A. of a graph I Weighted graph, where we assign (positive) weights as Markov chains scalars to every edge. 5 / 50 Non-negative Non-negative matrices in Graph-theory matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity and the How can we represent a (simple) graph using a matrix? adjacency matrix Multiple ways such as the adjacency matrix, degree matrix, I Distance distance matrix, incidence matrix, Laplacian matrix, etc. matrix Shortest path I Which graph type and which matrix representation you and Dijkstra's use depend on your application. algorithm Degree matrix of a graph Markov chains 6 / 50 Non-negative Application, road network and connectivity matrices and graphs MAA704 Christopher We consider a road network between different cities where we Engstr¨om want to know if we can drive from one city to another, or if we lecture 2 need to go by for example air/boat. Connectivity and the I We represent the road network using a undirected graph adjacency by letting the vertices represent the cities, and a edge matrix Distance between two cities means there is a road between the two matrix cities. Shortest path and Dijkstra's I If there is a edge between, say, two cities A; B we know algorithm there is a road and we can take the car. However if there Degree matrix of a graph isn't we might still be able to take the car for example by Markov chains passing city C which is both connected to cities A and B. I To solve this problem we define connectivity for graphs, and irreducibility for matrices. 7 / 50 Non-negative Connectivity matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity I Two vertices are said to be connected if by traversing and the adjacency the edges there exists a path from both of the nodes to matrix the other one. Distance matrix A graph is said to be connected if it is connected for all I Shortest path pair of nodes in the undirected graph. and Dijkstra's algorithm I A directed graph is said to be strongly connected if it is Degree matrix connected for all pair of nodes in the directed graph. of a graph Markov chains 8 / 50 Non-negative Connectivity: connected components matrices and graphs MAA704 Christopher A connected component in an undirected graph is a Engstr¨om maximal part of the graph where all nodes are connected with lecture 2 each other. Connectivity and the adjacency matrix Distance matrix Shortest path and Dijkstra's algorithm Degree matrix of a graph Markov chains Figure: A undirected graph with 3 connected components 9 / 50 Non-negative Connectedness: strongly connected components matrices and graphs MAA704 Christopher A strongly connected component is a part of the graph Engstr¨om which is strongly connected. lecture 2 Connectivity and the adjacency matrix Distance matrix Shortest path and Dijkstra's algorithm Degree matrix of a graph Markov chains Figure: A directed graph with 3 strongly connected components 10 / 50 Non-negative Application, road network and adjacency matrix matrices and graphs MAA704 Christopher Engstr¨om lecture 2 So if our two cities belong to the same connected component, Connectivity and the there is a path between them and we can take the car. adjacency matrix I But how do we find the connected components? Distance Especially if we have a large graph it might even be hard matrix Shortest path to visualize the graph. and Dijkstra's algorithm To solve the problem we use a matrix representation called I Degree matrix the adjacency matrix. of a graph Markov chains 11 / 50 Non-negative Application, road network and adjacency matrix matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Definition Connectivity and the The adjacency matrix A of a graph G with n vertices is a adjacency matrix square n × n matrix with elements ai;j such that: Distance matrix 1, if there is a link from vertex i to vertex j Shortest path ai;j = and Dijkstra's 0, otherwise algorithm Degree matrix If the graph is undirected we consider every edge between two of a graph vertices as linking in both directions. Markov chains 12 / 50 Non-negative Non-negative matrices in graph theory matrices and graphs MAA704 Christopher Example of an undirected graph and corresponding adjacency Engstr¨om matrix (vertices ordered A,B,C,D). lecture 2 Connectivity and the adjacency B matrix Distance matrix 2 3 Shortest path 0 1 1 1 and Dijkstra's algorithm 61 1 1 07 A C 6 7 Degree matrix 41 1 0 05 of a graph 1 0 0 0 Markov chains D 13 / 50 Non-negative Application, road network and adjacency matrix matrices and graphs MAA704 Christopher Engstr¨om lecture 2 We note that the adjacency matrix is not unique in itself, we Connectivity and the need to choose in what order we put our vertices in the matrix! adjacency matrix I Sometimes changing the order of the vertices (essentially Distance re-labeling the graph) can make certain structures more matrix Shortest path obvious. and Dijkstra's algorithm For example we could group vertices in the same I Degree matrix connected component together. of a graph Markov chains 14 / 50 Non-negative Adjacency matrix, other applications matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Connectivity and the A undirected or directed graph and it's adjacency matrix could adjacency also be used to represent other things such as: matrix Distance I Links between homepages, and PageRank. matrix Shortest path I Electrical or water flow networks. and Dijkstra's algorithm Linguistic relations between words or phrases. I Degree matrix of a graph Markov chains 15 / 50 Non-negative Path, cycle and length matrices and graphs MAA704 Christopher Engstr¨om Definition lecture 2 Connectivity Given a weighted or unweighted graph: and the adjacency I A path in a graph is a sequence of vertices e1; e2;:::; en matrix such that for every vertex in the sequence there is an edge Distance matrix to the next vertex in the sequence. Shortest path and Dijkstra's I If the first vertex in a path is the same as the last vertex algorithm we call it a cycle. Degree matrix of a graph The length of a path is the number of edges in the path I Markov chains (counting multiple uses of the same edge). 16 / 50 Non-negative Application, road network and adjacency matrix matrices and graphs MAA704 Christopher Engstr¨om lecture 2 Returning to our road network example, while a 1 at element Connectivity a means there is a road between those two cities, we still and the ij adjacency don't know how to find the connected components using the matrix adjacency matrix. Distance matrix k I We take a look at the powers A of the adjacency matrix. Shortest path and Dijkstra's I A non-zero element of A1 means there is a path of algorithm Degree matrix "length" 1 between the two vertices. (length as in number of a graph of edges) Markov chains 17 / 50 Non-negative Application, road network and adjacency matrix matrices and graphs MAA704 Christopher Engstr¨om 2 2 We look at A and when a single element aij > 0. lecture 2 2 Connectivity I For ai;j > 0 we need that at least one of and the adjacency ai;k ak;j > 0; k = 1; 2;:::; n. matrix a = 1 if there is an edge between i; k and a = 1 if Distance I i;k k;j matrix there is an edge between k; j.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    50 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us