A graph is a non-linear data structure that consists of a set of nodes (also known as vertices) connected by edges. It is widely used to represent relationships between objects or entities. In this article, we will explore the terminology associated with graphs in data structure.
A node or vertex is a fundamental unit of a graph.
It represents an entity or an object. In HTML, we can use the <b> tag to highlight the terms. For example, in a social network graph, each person can be represented by a node.
An edge represents a connection between two nodes.
It depicts the relationship or interaction between entities in a graph. We can use the <u> tag to underline important terms like “edge”. For instance, in a friendship graph, an edge connects two people who are friends.
3. Directed Graph
A directed graph (or digraph) is a graph where edges have a direction associated with them.
The direction indicates the flow or relationship between nodes. We can represent directed edges using arrow symbols or by adding directional information alongside the edge.
4. Undirected Graph
An undirected graph is a graph where edges have no direction associated with them. The relationship between nodes is symmetric, and edges are bidirectional.
5. Weighted Graph
In some scenarios, graphs may have weights associated with their edges. A weighted graph assigns numerical values to edges that represent certain properties such as distance, cost, time, etc.
6. Adjacent Nodes
In a graph, two nodes are said to be adjacent if there is a direct edge connecting them. The term adjacency is used to describe the relationship between nodes.
The degree of a node refers to the number of edges connected to that node. In an undirected graph, it represents the number of neighbors a node has.
A path in a graph is a sequence of edges that connects a series of nodes. It represents a route or traversal from one node to another.
A cycle in a graph is a path that starts and ends at the same node, passing through different nodes in between.
In this article, we have covered the fundamental terminology associated with graphs in data structure. Understanding these terms is essential for working with graphs efficiently and effectively.
To summarize, we discussed nodes, edges, directed and undirected graphs, weighted graphs, adjacent nodes, degree, paths, and cycles. By utilizing HTML styling elements like <b>, <u>,
, we have created an engaging and visually appealing article.
Now that you are familiar with the basic terminology related to graphs, you can further explore advanced concepts such as graph traversal algorithms (BFS and DFS), minimum spanning tree (MST), shortest path algorithms (Dijkstra’s algorithm), and more!