學海無涯,思境無維;數乃六藝,理之始也。
或有一得足矣 愚千慮
Graph Theory
Simple Directed Graph
initial vertex and terminal vertex
degree of a vertex
- indeg(v) : indegree of v, the number of edges that terminated at v.
- outdeg(v) : outdegree of v, the number of edges that initiate at v.
- deg(v) = indeg(v) + outdeg(v)
path : A path between and vertices can always be described by its edge list.
- The initial vertex of is x.
- The terminal vertex of is y.
- The number of edges in the edge list(n) is path length
- A edge could only exist once in a path.
circuit : A circuite is a path that terminates at it's initial vertex.
subpath : A subpath is any portion of the path describe by one or more consecutive edges in the edge list.
- any path is it's own subpath (but improper)
- all other non-empty subpath are called proper subpath
A path or circuite is simple, if contains no proper subpath that's a circuit.
Multigraph
The graph with a vertex(s) that contains more than one edge to other vertices.
Undirected Graph
The E(edges) are undirected,
Complete Graph ()
each pair of distinct vertices are directly connected to one another.
Round-robin (Tournament Graph) is a complete graph.
Single-elimination tournament graph (tree-like):
- once vertex(the champion) has no edge terminating at it and at least one edge initiating from it.
- every other vertex is the terminal vertex of exactly one edge.
- there is a path from the champion vertex to every other vertex.
Subgraph
let be a graph of any kind:
- directed / undirected
- multigraph / unidirected
is a subgraph of ,
when and the vertices of are in .
Induced subgraph (Remove vertices and the corresponding edges) : If the only removed edges are thost that include the removed vertices.
Spanning subgraph (Remove the edges only) : no vertices removed from , only edges.
Graph Isomorphism
The actual position(embedding) of vertices isn't an essential part of a graph.
Isomorphic Graphs
Two graphs and are isomorphic if there exists a bijection
, such that
Data Structure of Graphs
- Adjacency Matrix : , where indicates
- Edge Dictionary : a list of edges that initiate at that vertex.
- Edge List :
Connectivity
Let and be vertices of a directed graph.
- is connected : is connceted to $w $ if there is a path from to .
- strongly connceted : if they are connected in both directions.
- connected graph : for each pair of distinct vertices (v,w), is connected to or is connected to . (complete directed graph?)
- strongly connected graph : every pair of the connected graph is strongly connected(require both direction). For undirected graph, the edges are all bi-directional, so all connected undirected graph are strongly connected graph.
Maximal Path Theorem
For a graph with vertices, the longest path would be .
Adjacency Matrix Method
A graph
The adjacency matrix that G defines
indicating if there is an edge connecting to .
if there exists a path with length between to .
Shortest Path - Breadth-First Search (BFS)
Find the path of two connected vertices.
Search for the vertices that is not found yet in each iteration.
Search for (2, 3), the path from to
Distance Matrix
By using the BFS, we can get the distance between any two vertices. Then construct them into a matrix called distance matrix.
is the distance(depths) from to
Examine the matix to get
- Eccentricity of a Vertex: The maximum distance from a vertex to all other vertices.
- Diameter of a graph : the maximum eccentricty distance of vertices as diameter.
- Radius of a Graph : the minimum eccentricty of vertices in the graph.
- Center of a Graph : The set of vertices with minimal eccentricity.
Eulerian
Goal : Traverse all edges once.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Eulerian Path, Circuit and Graph
- Eulerian Path : a path whose edge list contains each edge of the graph exactly once.
- Eulerian Circuit : when an Eulerain path is a
circuit.
- Eulerian Graph : when the graph contains an Eulerian circuit.
Euler's Theorem
An undirected graph has an Eulerian path it's connected and has 0 or 2 vertices with an odd degree. if no vertex has an odd degree, then the graph is Eulerian
A.K.A.
except initial (possible with one more outdegree) and terminal (possible with one more indegree) vertices.
Complete Eulerian Graphs
The complete undirected graphs are Eulerian, if , then is not Eulerian.
Since all vertices in the complete graph() have edges(degree), therefore when .
Hamilton
Goal : Traverse all vertices once without using the same edge twice.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Hamilton Path, Circuit and Graph
- Hamilton Path : a path whose vertex list contains each vertex of the graph exactly once except when it's a circuit.
- Hamilton Circuit : when an Eulerain path is a
circuit(terminal=initial).
- Hamilton Graph : when the graph contains an Hamilton circuit.
The -cube
: bits binary string
The -cube is the undirected graph with a vertex for each string in and an edge connecting each pair of strings that differ in exactly on position. The -cube is normally denoted .
Analog-to-digital Convertion(ADC) and the Gray Code
Example of Gray Code in (aka. The 3-cube).
= The 1-cube.
, : is the reverse of
,
Graph Optimization
Weighted Graph
A weighted graph, is a graph with a weight function .
is the weight of edge .
The salesman problem
Travers all vertices with minimun cost(sum of weights) of the circuit.
The Closet Neighbor Algorithm
Pick the closet(the most light weighted) edge only. It may not be the optimal answer.
The Unit Square Problem
Control the robot arm to weld on all the vertices in the graph with shortest path(circuit).
The Strip Algotirhm
Networks and the Maximum Flow Problem
Network
A network is a simple weighted directed gram that contains two distinguished vertices called the source and the sink with the properties:
- the indegree of the source and the outdegree of the sink are both zero.
- source is connected to sink.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
The Maximum Flow Problem
- the capacity :
- flow :
- : flow can't be larger than the capacity
for all vertices except source and sink, the sum of flow into v () is equal to it's sum of flow out of v ().
Flow out of source equals Flow into sink.
- The value of a Flow : the two values flow into the sink and flow out of the source were the same, so the common value is called "the value of the flow". denoted by .
Ford and Fulkerson Algorithm (FFA)
9.5.24
Flow Augmenting Path
- : flows forward (unused capacity)
- : flows in reverse direction
Other Graph Optimization Problems
- The Minimum Spanning Tree Problem
- The Minimum Matching Problem
- The Graph Center Problem
find the vertex(called a center) of the graph that the distance from the center to every other vertex is as small as possible.
Planarity and Coloring
- Planarity : a graph be drawn in a plane and no edges intersect(cross).
- Coloring : color all vertices and no two vertices that are connected by an edge have the same color. (drawing a map so no two bordering countries are colored the same)
The Kuratowski Reduction Theorem states that if a graph is nonplanar then it “contains” either a or a
A planar graph devices the plane into one or more regions.
- Two points on the plane lie in the same region if u can draw a curve connecting the two points that does not pass through an edge.
If is a connected planar graph with regions, vertices, and edges,
9.6.10 A Bound on Edges of a Planar Graph
If is a connected planar graph with vertices, and edges,
Graph Coloring
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Graph Coloring
Undirected Graph, with a "coloring function" , and H has the smallest possible cardinality.
The cardinality of is called chromatic number of , denoted by .
The Four-Color Theorem
If is a planar graph, then
The Five-Color Theorem
If is a planar graph, then