Graphs are a fundamental data structure used to represent relationships between objects. They consist of nodes (also known as vertices) and edges (also known as links or connections) that connect these nodes.
A graph is a collection of nodes and edges, where nodes represent entities (such as cities, people, or web pages) and edges represent relationships between these entities.
In a directed graph, edges have a direction associated with them. This means that the relationship between nodes is one-way. For example, if node A has a directed edge to node B, it means that there is a relationship from A to B, but not necessarily from B to A.
In an undirected graph, edges have no direction associated with them. This means that the relationship between nodes is bidirectional. If node A is connected to node B in an undirected graph, it implies that node B is also connected to node A.