<<

Trees and , , networks and applications, MAA600

Christopher Engstr¨om Trees and distance, Lecture 5, trees and Graph theory, networks and applications, distance MAA600 Distance in trees and graphs

Christopher Engstr¨om

September 15, 2014 I If the graph is connected and acyclic it is called a

I A with one (only 1 connecting edge) is called a leaf.

I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic).

I A spanning forest is a spanning subgraph which is also a forest.

I A spanning tree is a spanning subgraph which is also a tree.

Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance

Distance in trees and graphs I A vertex with degree one (only 1 connecting edge) is called a leaf.

I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic).

I A spanning forest is a spanning subgraph which is also a forest.

I A spanning tree is a spanning subgraph which is also a tree.

Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance I If the graph is connected and acyclic it is called a tree Distance in trees and graphs I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic).

I A spanning forest is a spanning subgraph which is also a forest.

I A spanning tree is a spanning subgraph which is also a tree.

Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance I If the graph is connected and acyclic it is called a tree Distance in I A vertex with degree one (only 1 connecting edge) is trees and graphs called a leaf. I A spanning forest is a spanning subgraph which is also a forest.

I A spanning tree is a spanning subgraph which is also a tree.

Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance I If the graph is connected and acyclic it is called a tree Distance in I A vertex with degree one (only 1 connecting edge) is trees and graphs called a leaf.

I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic). I A spanning tree is a spanning subgraph which is also a tree.

Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance I If the graph is connected and acyclic it is called a tree Distance in I A vertex with degree one (only 1 connecting edge) is trees and graphs called a leaf.

I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic).

I A spanning forest is a spanning subgraph which is also a forest. Trees and Definitions distance, Graph theory, networks and applications, Definition MAA600 Christopher Engstr¨om I A graph with no cycle is called acyclic. Such a graph is called a forest. Lecture 5, trees and distance I If the graph is connected and acyclic it is called a tree Distance in I A vertex with degree one (only 1 connecting edge) is trees and graphs called a leaf.

I A subgraph of G with the same vertex set V (G) is called a spanning subgraph. (note that it does not need to be connected nor acyclic).

I A spanning forest is a spanning subgraph which is also a forest.

I A spanning tree is a spanning subgraph which is also a tree. This essentially means that every tree with more than one vertex can be constructed from a smaller tree by adding a new leaf.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, trees and Lemma distance

Every tree with at least two vertices has at least two leaves. Distance in trees and Deleting a leaf from a tree with n vertices produces a new tree graphs with n − 1 vertices. Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, trees and Lemma distance

Every tree with at least two vertices has at least two leaves. Distance in trees and Deleting a leaf from a tree with n vertices produces a new tree graphs with n − 1 vertices. This essentially means that every tree with more than one vertex can be constructed from a smaller tree by adding a new leaf. I G is connected and has n − 1 edges.

I G has n − 1 edges and has no cycles.

I G has no loops, and for every u, v ∈ V (G) there is exactly one from u to v. We will show the first statement, the others can be proved in a similar manner.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G has n − 1 edges and has no cycles.

I G has no loops, and for every u, v ∈ V (G) there is exactly one path from u to v. We will show the first statement, the others can be proved in a similar manner.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G is connected and has n − 1 edges. I G has no loops, and for every u, v ∈ V (G) there is exactly one path from u to v. We will show the first statement, the others can be proved in a similar manner.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G is connected and has n − 1 edges.

I G has n − 1 edges and has no cycles. We will show the first statement, the others can be proved in a similar manner.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G is connected and has n − 1 edges.

I G has n − 1 edges and has no cycles.

I G has no loops, and for every u, v ∈ V (G) there is exactly one path from u to v. We will show the first statement, the others can be proved in a similar manner.

Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G is connected and has n − 1 edges.

I G has n − 1 edges and has no cycles.

I G has no loops, and for every u, v ∈ V (G) there is exactly one path from u to v. Trees and Trees distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem For an n-vertex graph G (with n ≥ 1), the following statements Lecture 5, trees and are equivalent. distance Distance in I G is connected and has no cycles (a tree). trees and graphs I G is connected and has n − 1 edges.

I G has n − 1 edges and has no cycles.

I G has no loops, and for every u, v ∈ V (G) there is exactly one path from u to v. We will show the first statement, the others can be proved in a similar manner. Trees and Proof distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om To prove that statement 1, 2, 3 are equivalent it is enough to Lecture 5, show that any two of (connected, acyclic, n − 1 edges) implies trees and distance the third. Distance in (connected, acyclic) ⇒ n − 1 edges: It is easy to see that trees and graphs n − 1 edges are enough and necessary in order for a graph to be connected. Consider the case where we add vertices to a graph one at a time while ensuring that the graph is connected and acyclic at all times. For every new vertex we need to add one new edge connecting the new vertex with any of the old vertices. Trees and Proof, cont. distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, Since the new vertex have degree 1 it can never be part of any trees and distance

cycle, hence the resulting graph is still acyclic. Since every edge Distance in of an acyclic graph is a cut-edge we cannot remove any edge trees and graphs (so we need at least n − 1 edges). Also adding any more edge will always create a cycle between the two vertices connected by the new edge (since there is already an old path between them). Hence we cannot have more than n − 1 edges. I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

I Adding one edge to a tree forms exactly one cycle.

I Every connected graph contains a spanning tree.

Proof.

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

Lecture 5, trees and distance

Distance in trees and graphs I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

I Every connected graph contains a spanning tree.

Proof.

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and distance

Distance in trees and graphs I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

Proof.

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and I Every connected graph contains a spanning tree. distance Distance in trees and graphs I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

Proof.

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and I Every connected graph contains a spanning tree. distance Distance in trees and graphs I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and I Every connected graph contains a spanning tree. distance Distance in trees and Proof. graphs

I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14). I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree).

Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and I Every connected graph contains a spanning tree. distance Distance in trees and Proof. graphs

I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle. Trees and Trees distance, Graph theory, networks and applications, Corollary MAA600

Christopher I Every edge of a tree is a cut-edge. Engstr¨om

I Adding one edge to a tree forms exactly one cycle. Lecture 5, trees and I Every connected graph contains a spanning tree. distance Distance in trees and Proof. graphs

I Since a tree have no cycles, every edge is a cut-edge (Theorem 1.2.14).

I Since for a tree there is a unique path between any two vertices u, v, adding a new edge between them thus forms exactly one cycle.

I Can be seen by repeatedly deleting edges from cycles until we have a connected acyclic graph (spanning tree). I The diameter of a graph G (diam G) is max d(u, v). u,v∈V (G)

I The eccentrity of a vertex u, (u) is max d(u, v). v∈V (G)

I The radius of a graph G (rad G) is min (u). u∈V (G)

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Definition Lecture 5, trees and I The distance d(u, v) between two vertices u, v is defined distance as the shortest length of any u, v-path. If there is no path Distance in trees and between u, v then d(u, v) = ∞ . graphs I The eccentrity of a vertex u, (u) is max d(u, v). v∈V (G)

I The radius of a graph G (rad G) is min (u). u∈V (G)

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Definition Lecture 5, trees and I The distance d(u, v) between two vertices u, v is defined distance as the shortest length of any u, v-path. If there is no path Distance in trees and between u, v then d(u, v) = ∞ . graphs

I The diameter of a graph G (diam G) is max d(u, v). u,v∈V (G) I The radius of a graph G (rad G) is min (u). u∈V (G)

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Definition Lecture 5, trees and I The distance d(u, v) between two vertices u, v is defined distance as the shortest length of any u, v-path. If there is no path Distance in trees and between u, v then d(u, v) = ∞ . graphs

I The diameter of a graph G (diam G) is max d(u, v). u,v∈V (G)

I The eccentrity of a vertex u, (u) is max d(u, v). v∈V (G) Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Definition Lecture 5, trees and I The distance d(u, v) between two vertices u, v is defined distance as the shortest length of any u, v-path. If there is no path Distance in trees and between u, v then d(u, v) = ∞ . graphs

I The diameter of a graph G (diam G) is max d(u, v). u,v∈V (G)

I The eccentrity of a vertex u, (u) is max d(u, v). v∈V (G)

I The radius of a graph G (rad G) is min (u). u∈V (G) Proof. If diam G ≥ 3 then there exist at least two non-adjacent vertices u, v ∈ V (G) with no common neighbor. Hence every other edge x ∈ V (G) − {u, v} have at most one of u, v as a neighbor. This makes every vertex x ∈ G¯ adjacent to at least one of u, v ∈ G¯. Since there is an edge uv ∈ E(G¯) there is also a path of at most length 3 between any two vertices in G¯ (going through u, v).

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem ¯ Lecture 5, If G is a simple graph, then diam G ≥ 3 ⇒ diam G ≤ 3. trees and distance

Distance in trees and graphs Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om Theorem ¯ Lecture 5, If G is a simple graph, then diam G ≥ 3 ⇒ diam G ≤ 3. trees and distance Proof. Distance in trees and If diam G ≥ 3 then there exist at least two non-adjacent graphs vertices u, v ∈ V (G) with no common neighbor. Hence every other edge x ∈ V (G) − {u, v} have at most one of u, v as a neighbor. This makes every vertex x ∈ G¯ adjacent to at least one of u, v ∈ G¯. Since there is an edge uv ∈ E(G¯) there is also a path of at most length 3 between any two vertices in G¯ (going through u, v). Although the radius and diameter are useful, sometimes it can be more interesting to look at the average distance between vertices. Definition The Wiener index D(G) is defined as X D(G) = dG (u, v) u,v∈V (G)

n (Optionally divided by to get the average.) 2

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Definition Christopher The center of a graph G is the subgraph induced by the Engstr¨om

vertices of minimum eccentricity. Lecture 5, trees and distance

Distance in trees and graphs Definition The Wiener index D(G) is defined as X D(G) = dG (u, v) u,v∈V (G)

n (Optionally divided by to get the average.) 2

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Definition Christopher The center of a graph G is the subgraph induced by the Engstr¨om

vertices of minimum eccentricity. Lecture 5, trees and Although the radius and diameter are useful, sometimes it can distance be more interesting to look at the average distance between Distance in trees and vertices. graphs Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Definition Christopher The center of a graph G is the subgraph induced by the Engstr¨om

vertices of minimum eccentricity. Lecture 5, trees and Although the radius and diameter are useful, sometimes it can distance be more interesting to look at the average distance between Distance in trees and vertices. graphs Definition The Wiener index D(G) is defined as X D(G) = dG (u, v) u,v∈V (G)

n (Optionally divided by to get the average.) 2 Can easily be seen by repeatedly removing all leaves (which always have a 1 higher eccentrity than the ones they are linked to). Theorem The Wiener index for a tree with n vertices is minimized by stars and maximized by paths, both uniquely.

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Theorem Lecture 5, trees and The center of a tree is a vertex or an edge. distance Distance in trees and graphs Theorem The Wiener index for a tree with n vertices is minimized by stars and maximized by paths, both uniquely.

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Theorem Lecture 5, trees and The center of a tree is a vertex or an edge. distance Distance in Can easily be seen by repeatedly removing all leaves (which trees and always have a 1 higher eccentrity than the ones they are linked graphs to). Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Theorem Lecture 5, trees and The center of a tree is a vertex or an edge. distance Distance in Can easily be seen by repeatedly removing all leaves (which trees and always have a 1 higher eccentrity than the ones they are linked graphs to). Theorem The Wiener index for a tree with n vertices is minimized by stars and maximized by paths, both uniquely. Proof. Every path in H also exist in G, hence the shortest path between two vertices in G is no longer than the shortest in H.

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, trees and Lemma distance If H is a subgraph of G then dG (u, v) ≤ dH (u, v) Distance in trees and graphs Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, trees and Lemma distance If H is a subgraph of G then dG (u, v) ≤ dH (u, v) Distance in trees and graphs Proof. Every path in H also exist in G, hence the shortest path between two vertices in G is no longer than the shortest in H. Proof. If T is a spanning tree of G then using the previous lemma D(G) ≤ D(T ). Since D(G) for a tree is maximized for the we have D(G) ≤ D(Pn).

Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, Corollary trees and distance

If G is a connected graph with n vertices, then D(G) ≤ D(Pn) Distance in where P is the path graph with n vertices. trees and n graphs Trees and Distance in trees and graphs distance, Graph theory, networks and applications, MAA600

Christopher Engstr¨om

Lecture 5, Corollary trees and distance

If G is a connected graph with n vertices, then D(G) ≤ D(Pn) Distance in where P is the path graph with n vertices. trees and n graphs Proof. If T is a spanning tree of G then using the previous lemma D(G) ≤ D(T ). Since D(G) for a tree is maximized for the path graph we have D(G) ≤ D(Pn). I Closeness CC (u) is equal to 1 divided by the sum of all shortest paths between u and all other vertices.

I CB (u) is the proportion of shortest paths between other vertices where u is an intermediate vertex.

I PageRank centrality CP can be seen as the stationary distribution of a certain random walk on the graph.

Trees and Centrality (if time) distance, Graph theory, networks and applications, MAA600 Another way to measure how ”central” or ”important” a vertex Christopher Engstr¨om is in a graph is through the use of centrality measures. There is Lecture 5, a large amount of different centrality measures for all kind of trees and applications. distance Distance in I Degree centrality, CD (u) is equal to the degree of vertex u. trees and graphs I Betweenness centrality CB (u) is the proportion of shortest paths between other vertices where u is an intermediate vertex.

I PageRank centrality CP can be seen as the stationary distribution of a certain random walk on the graph.

Trees and Centrality (if time) distance, Graph theory, networks and applications, MAA600 Another way to measure how ”central” or ”important” a vertex Christopher Engstr¨om is in a graph is through the use of centrality measures. There is Lecture 5, a large amount of different centrality measures for all kind of trees and applications. distance Distance in I Degree centrality, CD (u) is equal to the degree of vertex u. trees and graphs I CC (u) is equal to 1 divided by the sum of all shortest paths between u and all other vertices. I PageRank centrality CP can be seen as the stationary distribution of a certain random walk on the graph.

Trees and Centrality (if time) distance, Graph theory, networks and applications, MAA600 Another way to measure how ”central” or ”important” a vertex Christopher Engstr¨om is in a graph is through the use of centrality measures. There is Lecture 5, a large amount of different centrality measures for all kind of trees and applications. distance Distance in I Degree centrality, CD (u) is equal to the degree of vertex u. trees and graphs I Closeness centrality CC (u) is equal to 1 divided by the sum of all shortest paths between u and all other vertices.

I Betweenness centrality CB (u) is the proportion of shortest paths between other vertices where u is an intermediate vertex. Trees and Centrality (if time) distance, Graph theory, networks and applications, MAA600 Another way to measure how ”central” or ”important” a vertex Christopher Engstr¨om is in a graph is through the use of centrality measures. There is Lecture 5, a large amount of different centrality measures for all kind of trees and applications. distance Distance in I Degree centrality, CD (u) is equal to the degree of vertex u. trees and graphs I Closeness centrality CC (u) is equal to 1 divided by the sum of all shortest paths between u and all other vertices.

I Betweenness centrality CB (u) is the proportion of shortest paths between other vertices where u is an intermediate vertex.

I PageRank centrality CP can be seen as the stationary distribution of a certain random walk on the graph.