Graph Routes

Graph Routes

Kai-Jie Lin Lv3

Graph Routes

Definition 2.1

  • A walk is a sequence of vertices so that there is an edge between consecutive vertices. A walk can repeat vertices and edges.
  • A trail is a walk with no repeated edges. A trail can repeat vertices but not edges.
  • A path is a trail with no repeated vertex (or edges). A path on n vertices is denoted PnP_{n}.
  • A closed walk is a walk that starts and ends at the same vertex.
  • A circuit is a closed trail; that is, a trail that starts and ends at the same vertex with no repeated edges though.
  • A cycle is a closed path; that is, a path that starts and ends at the same vertex. Thus cycles cannot repeat edges or vertices. A cycle on n vertices is denoted CnC_{n}.

The length of tours = number of edges.

Definition 2.2

  • Let GG be a graph. Two vertices x and y are connected if there exists a path from x to y in GG. The graph GG is connected if every pair of distinct vertices is connected.

Theorem 2.3

  • Every xyx-y walk contains an xyx-y path.
    • Proof:
      Prove this by induction. Suppose ll be the length of ab xyx-y walk WW.
      When l=0l=0, then the walk does not have any vertices and edges so it contains a single vertex, that is x=yandsox=y and so Wisapathoflength0. is a path of length 0. Supppose l0l \ge 0 and the claim holds for true for all k<lk \lt l. If WW has no repeated vertex, then it cannot have any repeated edges and so WW is an xyx-y path. Otherwise WW has a repeated vertex, call it uu. We can remove all edges and vertices between two appearances of uu in the ealk, and leave only one copy of uu. This will produce a shorter xyx-y walk WW' which is contained in WW. Thus, by the induction hypothesis we know WW' contains an xyx-y path PP, which is also contained in WW. Thus WW contains an xyx-y path PP.

Definition 2.4

  • An object XX is maximum if it is the largest among all objects under consideration; that is, XAAU|X| \ge |A| \forall A \in \mathcal{U}. An object XX is maximal if it cannot be made larger.

Theorem 2.5

  • If every vertex of a graph has degree at least 2 than GG contains a cycle.

Eulerian Graphs

Definition 2.6

  • Eulerian circuit is a circuit that contains every edge and every vertex of graph GG.

Theorem 2.7

  • A graph GG is eulerian     \iff GG is connected and every vertex has even degree.
    • Proof:
    1. (    )(\implies)
      GG is eulerian.
          \implies There is a circuit CC containing every edge and vertex of GG.
          \implies GG is connected.
      The circuit CC is a trail that starts and ends at the same vertex.
          \implies For every vertex, there at least exists a pair of edges in and out.
          \implies Every vertex has even degree.     \implies GG is connected and every vertex has even degree.
    2. (    )(\impliedby)
      The proof processed by induction. Suppose GG has m>0m > 0 edges and that for all kk, with m>k0m > k \ge 0 that any connected graph GG' with kk edges and all vertices of even degree have an eulerian circuit.

      By Theorem 2.5, all vertices in GG have at least degree 2, then GG contains a cycle CC. Let GG' be the graph obtained by deleting all the edge of CC. GG' has less edges than GG, thus it contains an eulerian circuit. To find the eulerian circuit of GG, we traverse CC but when a component of GG' is encountered, we detour along its eulerian circuit. This detour will start and end at the same vertex, and we continue traversing CC until all edges being traveled, thus completing an eulerian circuit of GG.

Algorithm for finding Eulerian circuit

Fleury’s Algorithm

  • Given a graph GG where zero or two vertices are odd. If GG has no odd vertices, then any vertex can be teh starting point. If GG has odd vertices, then the starting point must be one of the odd vertices. From the starting point, using dfs travel through all edge and label the edge have been traveled. Then we have labeled eulerian circuit or trail. The complexity is the cost of doing dfs.

Hierholzer’s Algorithm

  • Given a graph GG where all vertices are even.
    1. Select a starting vertex vv, and find a circuit CC originating at vv.
    2. Find any vertex xx on CC has edges not appearing in CC, find a cicuit CC' originating at xx.
    3. Combine CC and CC' into a single circuit CC*.
    4. Repeat (2) and (3) until all edge of GG are used.

Hamiltonian Cycles

Definition 2.10

  • Hamiltonian cycle is a cycle in a graph GG that contains every vertex of GG.
  • Hailtonian path is a path that contains every vertex.
  • A graph that contains a hamiltonian cycle is called hamiltonian.

Properties of Hamiltonian Graphs

  • GG must be connected.
  • No vertex of GG have degree less than 2.
  • GG cannot contain a **cut-vertex**, i.e. a vertex whose removal disconnects the graph.
  • If GG contains a vertex xx of degree 2 then both edges incident to xx must be included in the cycle.
  • If two edges incident to a vertex xx must be included in the cycle, then all other edges incident to xx cannot be used in the cycle.
  • If in the process of attempting to build a hamiltonian cycle, a cycle is formed that does not span GG, then GG cannot be hamiltonian.

Theorem 2.12 (Dirac’s Theorem)

  • Let GG be a graph with n3n \ge 3 vertices. If every vertex of GG satisfies deg(v)n2deg(v) \ge \frac{n}{2}, then GG has a hamiltonian cycle.
    • Proof: Noted that GG is connected. Let P=x0x1...xnP = x_{0}x_{1}...x_{n} be a path that contains all vertices in GG. Let SS be the set of vertices that are adjacent to xnx_{n} i.e. S={xi:xixnE(G)}S = \{x_{i}:x_{i}x_{n} \in E(G)\}. Let TT be the set of vertices whise immediate neighbor on PP is adjacent to x0x_{0} i.e. T={xi:xi+1x0E(G)}T=\{x_{i}:x_{i+1}x_{0} \in E(G)\}. Since both x0x_{0} and xnx_{n} have degree n2\ge \frac{n}{2} we know S+Tn|S| + |T| \ge n.
      Since ST<n|S \cup T| \lt n, thus ST=S+TST|S \cup T| = |S| + |T| - |S \cap T|, then we have ST1|S \cap T| \ge 1. There exists some vertex xix_{i} s.t. x0x+i+1,xixnE(G)x_{0}x+{i+1},x_{i}x_{n} \in E(G). Consider the cycle C=x0PxixnPxi+1x0C = x_{0} \underset{P}{-} x_{i}x_{n}\underset{P}{-}x_{i+1}x_{0}, where xPyx \underset{P}{-}y indicates travaling from xx to yy along path PP. Thus CC forms a hamiltonian cycle.

Theorem 2.13 (Ore’s Theorem)

  • Let GG be a graph with n3n \ge 3 vertices. If deg(x)+deg(y)ndeg(x) + deg(y) \ge n for all distinct nonadjacent vertices, then GG has a hamiltonian cycle.

Definition 2.14

  • The hamiltonian closure of a graph GG, denoted cl(G)cl(G) is the graph obtained from GG by iteratively adding edges between pairs of nonadjacent vertices whose degree sum is at least nn, that is we add an edge between xx and yy if deg(x)+deg(y)ndeg(x) + deg(y) \ge n, until no such pair remains.

Theorem 2.16

  • A graph GG is hamiltonian     cl(G)\iff cl(G) is hamiltonian.

Lemma 2.17

  • If GG is graph with at least 3 vertices such that its closure cl(G)cl(G) is complete, then GG is hamiltonian.

Theorem 2.18 (Posa’s Theorem)

  • Let GG be a simple graph where the vertices have degree d1,d2,...,dnd1,d2,...,dn such that n3n \ge 3 and the degrees are listed in increasing order. If for any i<n2i \lt \frac{n}{2} either di>id_{i} \gt i or dninid_{n-i} \ge n-i, then GG is hamiltonian.
    • Proof: We will cl(G)cl(G) is a complete graph, so by Lemma 2.17 we would know that both cl(G)cl(G) and GG are hamiltonian. Suppose for a contradiction that cl(G)cl(G) is not complete. Then there exist nonadjacent vertices xx and yy in cl(G)cl(G), and degcl(G)(x)+degcl(G)(y)n1deg_{cl(G)}(x) + deg_{cl(G)}(y) \le n-1, as otherwise xyxy would be added to GG in the formation of cl(G)cl(G). Choose xx and yy among all such nonadjacent pairs in cl(G)cl(G) so that the sum of their degrees in cl(G)cl(G) (TBD).

The Traveling Salesman Problem

Problem Statement

Given a weighted complete graph, find the hamiltonian cycle with least total weight.

Brute Force Algorithm

  • Find all possible hamiltonian cycles and pich the one with smallest weight.
  • Time Complexity: n!n!.

Nearest Neighbor Algorithm

  • Always choose the least weight among adjacent node.
  • Time complexity is n2n^2.
  • Repetitive Nearest Neighbor Algorithm means considering every vertex as starting vertex and apply NN. This way may find more optimal solution.
  • Approximate Algorithm with lower computation cost but not always optimal.
  • Repeat pick the one with the smallest weight among all edges with two conditions: (1) no vertex has three highlighted edges incident to it; (2) no edge is chosen so that a cycle closes before hitting all the vertices.
  • Also an approximate algorithm. Generally perform well than NN.

Nearest Insertion Algorithm

  1. First choose the smallest edge, hightlight the edge and its endpoints.
  2. Pick a vertex which is cloest to the one of the two already chosen vertices,, highlight the new vertex and its edges to both previously chosen vertices.
  3. Pick a vertex that is cloest to the one of the three chosen vertices. Calculate the increase in weight obtained by adding two new edges and deleting a previously chosen edge. Choose the scenario with the smallest total.
  4. Repeat (3) until all vertices have been included.

Shortest Paths

Dijkstra’s Algorithm

  • Given weighted connected simple graph G=(V,E,w)G=(V,E,w).
  1. Let uu be the start vertex, and L(x)L(x) means the shortest path from uu to xx.
  2. For the current vertex uu, find the vertex vv with lowest weight and update
L(v)=min(L(v),L(u)+w(uv))L(v) = min(L(v), L(u) + w(uv)). Let u=vu=v;
  1. Repeat step 2 until all vertex have been traveled.
  • One source to many vertex. Timecomplexity: O(nlog(n))O(nlog(n)).

Theorem 2.24 Walks Using Matrices

Let AA be the adjacency matrix of graph GG. n>0,aij\forall n \gt 0, a_{ij} in AnA^n counts the number of walks from viv_{i} to vjv_{j} using n edges.

Definition 2.25

  • distance: d(x,y)d(x,y) is the shorest length from node xx to yy.
  • eccentricity: ϵ(x)=maxyV(G)d(x,y)\epsilon(x) = max_{y\in V(G)}d(x,y).
  • diameter: maximum eccentricity among all vertices. diam(G)=maxx,yV(G)d(x,y)diam(G)=max_{x,y\in V(G)}d(x,y).
  • radius: minimum eccentricity. rad(G)=minxV(G)ϵ(x)rad(G) = min_{x\in V(G)}\epsilon(x).

Theorem 2.26

  • If GG is disconnected then Gˉ\bar{G} is connected and diam(Gˉ)2diam(\bar{G}) \le 2.
  • Proof: We are going to prove that for any pairs of vertex xx and yy, there is a xyx-y path.
    1. For xy∉E(G)xy \not\in E(G), then xyE(Gˉ)xy \in E(\bar{G}).
    2. For xyE(G)xy \in E(G), then xx and yy are not adjacent in E(Gˉ)E(\bar{G}). z\exists z such that zz is in different component from xx and yy
        xz,yzE(Gˉ)    \implies xz,yz \in E(\bar{G}) \implies there is xyx-y path in GG.

Theorem 2.27

  • For a simple graph GG if rad(G)3rad(G) \ge 3 then rad(Gˉ)2rad(\bar{G}) \le 2.

Theorem 2.28

  • For any simple graph GG, rad(G)diam(G)2rad(G)rad(G) \le diam(G) \le 2rad(G).

Definition 2.29

Let GG be a graph with rad(G)=rrad(G) = r. Central vertex is the vertex x which has rad(x)=rrad(x)=r.

Definition

  • girth: the minimul length of a cycle in GG.
  • circumference: the maximum length of a cycle.

Theorem 2.31

If GG is a graph with at least one cycle then girth(G)2diam(G)+1girth(G) \le 2diam(G)+1.

  • Proof note: use the property of shortest path.

Theorem 2.32

Let GG be a graph with nn vertices, radius at most kk, and maximum degree at most dd, with d3d \ge 3. Then n<dd2(d1)kn < \frac{d}{d-2}(d-1)^k.

Comments