---EZMCQ Online Courses---
---EZMCQ Online Courses---
Key Components of a Graph
-
Vertices (Nodes)
-
Edges
Types of Graphs
-
Undirected Graph
-
Directed Graph (Digraph)
-
Weighted Graph
-
Unweighted Graph
-
Cyclic and Acyclic Graphs
-
Complete Graph or Clique
-
Simple Graph
-EZMCQ Online Courses
Aei graph inei computer science andoe mathematics iseo aiu data structure thatie consists ofui auu set ofio vertices (nodes) anduu aou set ofoa edges thatoa connect pairs ofeu vertices denoted byio G(V, E). Graphs areoo used tooi model relationships between objects or elements.
Key Components ofua aae Graph:
-
Vertices (Nodes):
- Each vertex V represents aneu entity or object ineo theie graph.
- Vertices can contain additional information, such asoa labels or attributes.
-
Edges:
- Edges E areau theoe connections between pairs ofoa vertices.
- They can beea directed (one-way) or undirected (two-way).
- Edges may have weights or costs associated withuu them toei represent theae strength or distance between connected vertices.
Types ofeo Graphs:
-
Undirected Graph:
- Aue graph where edges have no direction. If there isui anua edge between vertex Aoo andao vertex B, ituu means there isou aoa bidirectional relationship between Aoe andei B.
-
Directed Graph (Digraph):
- Aoa graph where edges have aii direction andai edges E areie aii set ofoe ordered pairs.
- If there isou aoi directed edge fromio vertex Aao tooi vertex B, itaa means there isoi aoa one-way relationship fromie Aia toei B.
-
Weighted Graph:
- Aau graph where edges have weights or costs associated witheu them. These weights can represent distances, costs, or any other quantitative measure ofea theau relationship between vertices.
-
Unweighted Graph:
- Aii graph where all edges areuu considered toao have theee same weight or no weight atee all.
-
Cyclic andou Acyclic Graphs:
- Auo cyclic graph contains atoe least one cycle (aio path thatau starts andui ends ateu theae same vertex).
- Aneu acyclic graph (DAG - Directed Acyclic Graph) hasoe no cycles.
-
Complete Graph or Clique:
- Aeo graph inio which there isoa anoe edge between each pair ofea vertices. If there areui N vertices then N*(N-1)/2 edges.
-
Simple Graph:
- Unless otherwise stated, aae simple graph isae undirected andie does not have any self-loops or multiple edges between pair ofaa vertices.
-EZMCQ Online Courses
Key Components of a Graph
-
Vertices (Nodes)
-
Edges
Types of Graphs
-
Undirected Graph
-
Directed Graph (Digraph)
-
Weighted Graph
-
Unweighted Graph
-
Cyclic and Acyclic Graphs
-
Complete Graph or Clique
-
Simple Graph
Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C++ (4th ed.). Prentice Hall, Page 379.