Definition

A graph is a mathematical structure consisting of a set of nodes (also called vertices) and a set of edges, where each edge relates a pair of nodes.

Basic Concepts

  • Adjacent: Two vertices are adjacent if there is an edge between them.
  • Outgoing Edge: In a directed graph, an outgoing edge from a node is any edge for any node .
  • Path: A path between two nodes is a sequence of edges and nodes between two endpoints. When the graph is directed, the path typically follows outgoing edges only.
  • Cycle: A cycle is any non-trivial path that starts and ends at the same node.

Types of Graphs