Graph
A graph is a pair of sets where is a set of vertices and is a set of edges.
- If is a set of unordered pairs, the graph is called undirected. If is a set of ordered pairs, the graph is called directed.
- self-loop does not allowed in undirected graph (in csc236/csc263)
- Weight of edge is a function where is the weight of edge
- A matching is a subset of edges that those edges that do not share any end points
- every vertex in one matching then this matching is perfect
- two vertices are adjacent if
- one is called neighbor of the other
- an edge (u,v) is incident on vertices u and v. In a directed graph, the terminology differentiates between the beginning and ending vertex of an edge. So edge (u,v) which leaves vertex u is said to be incident from vertex u and is incident to (or enters) vertex v
- A sequence of distinct vertices is a path from to if for every and are adjacent.
- The length of the path is the number of edges in the path.
- A simple path contains no repeated edge
- A sequence of distinct vertices is a the cycle if is a path, and
- A cycle is called Hamiltonian if every vertex appear in the cycle exactly once (except for the start/end vertex which appears twice)
- A simple circle contains no repeated edge
- A -(vertex) coloring of is a function ,
- Connected: there is some path from to
- acyclic: no cycle in graph
- independent set: , is an independent set
- In an undirected graph, the degree of a vertex is the number of edges incident on . In a directed graph, the in-degree of vertex is the number of edges incident to (the size of set ) and the out-degree is the number of edges incident from v (the size of set ).
- A connected component is a group of nodes that are connected by edges
Tree: a graph are connected and acyclic
- Trees minimally connected graph aka remove any edge will cause disconnect
- Trees maximally acyclic graph aka add any edge will cause cycle
- unique path from to
- Free tree is used for an undirected connected acyclic graph without a specific vertex designated as the root.
- Rooted tree with one vertex is designated as the root.
A forest is a collection of (0+) disjoint trees
- A tree is also a forest.
- Total vertices - Total Edges = # trees
Binary Tree: a tree that every vertex has at most two edges incident to it.
Some examples about Graph:
- locations on maps, relationship between people(contact facing), Courses, WIFI Connection, Trees, vector graph, airport routes, functions, binary relations
Matching Problem:
- input: a graph with weight
- output: A matching (usually maximum/minimum)
Pathing Finding Problem:
- Input: a graph and two vertices
- output: A path between two vertices
Travelling Salesman Problem:
- Input: a graph and a start vertex
- Output: a Hamiltonian cycle minimizes the total edge weights
Coloring Problem:
- input: a graph
- output a k-coloring of the graph
Independent Set Problem:
- input: a graph, a number with
- output: An independent set of size
We also talked more about graph on csc263