1 / 22

Graph Concepts

Graph Concepts. Samia Qader Hw # 5 all images obtained from LEDA software in the following directory: 252a/handout/demo/graphwin/graphwin. Nodes, Edges. Graph G = (V,E) where V = (1,2, ..,n)

nico
Download Presentation

Graph Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Graph Concepts Samia Qader Hw # 5 all images obtained from LEDA software in the following directory: 252a/handout/demo/graphwin/graphwin

  2. Nodes, Edges • Graph G = (V,E) where V = (1,2, ..,n) n= no.of nodes or vertices E= the edge set of G, its elements are called edges • Examples of nodes: 0,1,2,3 • Examples of Edges: between 0,1 and 0,2

  3. Multiple Edges • When there is more than one edge between a set of vertices this is known as a multiple edge. • Example: Multiple edge between nodes 2 and 5

  4. Loops • A loop is an edge leaving from one vertex(node), returning to the same vertex. • Example: loop on node 3

  5. Undirected Graph • An undirected G= (V,E), the edge set E consists of unordered pair of vertices. • Self-loops are forbidden in an undirected graph

  6. Directed Graph (digraph) • A directed graph or digraph G is a pair (V,E) such that the edge set E has an ordered pair of vertices.

  7. Simple Graph • A simple graph has no loops and no multiple edges

  8. Examples of graphs • Graph G = (V,E) where V = (1,2, ..,n) n= no.of nodes or vertices E= the edge set of G, its elements are called edges

  9. Examples of multigraphs • A multigraph is like an undirected graph but it can have both multiple edges between vertices and self-loops

  10. A Complete Graph • A complete graph is an undirected graph in which every pair of vertices is adjacent (i.e. there is an edge between every pair of vertices)

  11. A bipartite graph • In a bipartite graph, the vertices are divided into two classes and all the edges go between these two classes of vertices.

  12. A path in an undirected graph • A path in an undirected graph from vertex a to vertex z is a sequence of vertices (v0,v1,..,vk) s.t. a = v0 and z= vk. • The length of the path is the number of edges in the path • Example: path from 0 to 5 is of length 5.

  13. Path in a directed graph • A path in an undirected graph from vertex a to vertex z is a sequence of vertices (v0,v1,..,vk) s.t. a = v0 and z= vk. • The length of the path is the number of edges in the path • Example: path from 0 to 5 is of length 5.

  14. Hamilton Path Example 1 • Hamilton path in a graph is a path that spans all vertices • Example 1: In a directed graph • Example 2: In an undirected graph Example 2

  15. A cycle in a directed graph • In a directed graph, a path (v0,v1,…,vk) forms a cycle if v0=vk and the path contains at least one edge • In a cycle, each vertex has exactly 2 neighbors and the graph is connected

  16. A cycle in an undirected graph • In an undirected graph, a path (v0, v1, …,vk) forms a cycle if v0 = vk and v0,v1,..,vk are distinct • Example: nodes 0,1,2,3 form a cycle

  17. Hamilton Cycle Example 1 • A Hamilton Cycle is a cycle that covers all the vertices • Example 1: A Hamilton Path in a digraph • Example 2: A Hamilton Path in an undirected graph Example 2

  18. Cyclic and Acyclic Digraphs • A cyclic digraph contains cycles- example 1 • An acyclic digraph has no cycles- example 2 Example 1 Example 2

  19. Tree • A tree is a special class of graphs. It is a connected, acyclic, undirected graph.

  20. Forest • A group of trees that is not connected is called a forest • If an undirected graph is acyclic but possibly disconnected, it is a forest

  21. Graph which is not connected Example 1 • An undirected graph is not connected if every pair of vertices is not connected by a path. • Example1: This graph is not connected because vertex 2 is not connected by a path.

  22. Graph which is not connected Example 2 • Example 2: This graph is not connected since vertices 2 and 8 are not connected by a path.

More Related