You are on page 1of 4

Undirected Graphs

Graphs are composed of two components: vertices and edges. Vertices are essentially points. (They are also referred to as nodes.) Typically, they will be labeled on a graph. In an ndirected graph, edges are simply lines in between pairs of vertices. !o, for e"ample, in a graph with n vertices, the ma"im m n mber of edges is n#$ % n(n&')($. This is the n mber of edges in a complete graph. ) complete graph is a graph where there e"ists an edge between all pairs of vertices. *e will define the degree of each verte" of a graph to be the n mber of edges that are incident to that verte". ) walk in a graph is a se+ ence of edges that can be traversed one by one. (This essentially means that the endpoint of an edge in a path has to be the starting point of the ne"t edge in the path.) It is permissible for a wal, to start and end in the same place. (-r, of co rse, start and end in different places.) ) graph is connected if there e"ists a path in between all pairs of vertices. .ere is an e"ample of a ndirected graph:

/irected Graphs
The only difference between a directed graph and an ndirected one is how the edges are defined. In an ndirected graph, an edge is simply defined by the two vertices it connects. 0 t, in a directed graph, the 1direction2 of the edge matters. 3or e"ample, let4s say a graph has two vertices v and w. In a directed graph with these two vertices, we wo ld be allowed to have more than one edge. *e co ld have an edge from v T- w, and another one from w T- v. In essence, each edge not only connects a pair of vertices, b t also has a direction associated with it. Using a formal definition, the set of edges of a directed graph G can be defined as a s bset of the cartesian prod ct V " V, where V is the set of vertices. )ll of the other definitions listed for ndirected graphs apply to directed ones. )lso, when we tal, abo t the degree of a verte" in a directed graph, we have to disting ish between the 1in2 degree and the 1o t2 degree. )t each verte", edges are either coming in or going o t. The in degree of a verte" is simply the s m of the n mber of edge coming in to that verte". The o t degree is defined similarly.

5aths, #ycles, Trails, and #irc its


) wal, which contains no repeated vertices is a path. ) path is called a cycle if the first and last vertices visited are the same. -ne interesting thing to note is that if yo have a wal, in a graph that travels from verte" a to verte" b repeating some vertices, then yo m st have a path that also goes from a to b. *hy6 ) trail is a wal, which contains no repeated edges. ) circ it is a trail that begins and ends at the same verte". The mathematician 7 ler who lived in 8onigsberg showed that it was impossible to wal, thro gh the entire town sing each of the 9 bridges in the town e"actly once and end p where yo started from. )n 7 ler circ it is defined as a circ it in a graph where each edge is traversed e"actly once. ) graph can have an 7 ler circ it only if the degree of each verte" is even. To see this, note that every verte" yo enter, yo m st also leave, sing a different edge in yo r path. Th s, for each time a verte" is visited, yo can 1s btract2 a degree of $ from that verte" of the edges that have yet to be visited.

It t rns o t that this is a s fficient and necessary condition. *hat that means is that if a graph has an even degree at each verte", it definitely has an 7 ler circ it. *e also ,now that the s m of the degrees of the vertices of a graph is $ times the n mber of edges. *hy6 This is typically called the handsha,ing lemma, which basically says in any sit ation where " n mber of people sha,e hands with each other, the total n mber of handsha,es s mmed over all of these people m st be an even n mber. The :TV view of loo,ing at the handsha,ing lemma wo ld be if yo as,ed everyone in the world how many people they4ve had se" with (or how many times they have had se"), and added p all the responses, yo 4d have to get an even n mber, ( nless yo incl de threesomes, in the mi", of co rse;;;)

You might also like