Graph1 - Graphs - Introduction Show real-life problems...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Graphs - Introduction z Show real-life problems using graphs. z Give algorithms to solve common graph problems. z Show how the choice of data structures can drastically reduce the running time of these algorithms. z See how depth-first search can be used to solve nontrivial problems in linear time.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Examples z Algorithms to find the minimum path between two nodes z Algorithms to find the maximum flow between two nodes z Algorithms for breadth-first search BFS and depth-first search DFS of a graph
Background image of page 2
3 Definitions z Graphs is an important mathematical structure. z A graph G = ( V , E ) consists of a set of vertices (or nodes ), V , and a set of edges , E . z Each edge is a pair ( v , w ), where v , w V . Edges are sometimes referred to as arcs . z If e = ( v , w ) is an edge with vertices v and w , the v and w are said to lie on e , and e is said to be incident with v and w .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Definitions z If the pairs are unordered, then G is called an undirected graph ; if the pairs are ordered, the G is called a directed graph . z The term directed graph is often shortened to digraph , and the unqualified term graph usually means undirected graph .
Background image of page 4
5 Definition z Vertex w is adjacent to v if and only if ( v , w ) E . z In an undirected graph with edge ( v , w ), and hence ( w , v ), w is adjacent to v and v is adjacent to w . z Sometimes an edge has a third component, known as either a weight or a cost .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Path Definition z A path in a graph is a sequence of vertices w 1 , w 2 , w 3 , . . . , w n such that ( w i , w i +1 ) E for 1 i < n . z The length of a path is the # of edges on the path, which is equal to n -1. z We allow a path from a vertex to itself; if this path contains no edges, then the path length is 0.
Background image of page 6
7 Path Definition z If the graph contains an edge ( v , v ) from a vertex to itself, then the path v , v is sometimes referred to as a loop . z A simple path is a path such that all vertices are distinct, except that the first and last could be the same.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Cycle Definition z A cycle in a directed graph is a path of length at least 1 such that w 1 = w n ; this cycle is simple if the path is simple. z For undirected graphs, we require that the edges be distinct. z Why? The logic of these requirements is that the path u , v , u in an undirected graph should not be considered a cycle, because ( u , v ) and ( v , u ) are the same edge.
Background image of page 8
9 Cycle Definition z In a directed graph, these are different edges, so it makes sense to call this a cycle. z A directed graph is acyclic if it has no cycles. z A directed acyclic graph is sometimes referred to by its abbreviation, DAG .
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Connectedness Definition z An undirected graph is connected if there is a path from every vertex to every other vertex. z
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 60

Graph1 - Graphs - Introduction Show real-life problems...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online