The range and domain are fundamental concepts in graph theory, crucial for understanding and analyzing graphs. They provide insights into the structure and properties of a graph, helping us answer questions like "Which vertices are reachable from others?" and "What are the possible outcomes of a process modeled by a graph?"
Understanding Graphs
Before delving into the range and domain, let's briefly recap graphs. A graph G is an ordered pair (V, E), where V is a set of vertices (or nodes), and E is a set of edges (or lines) connecting these vertices. A graph can be directed or undirected, depending on whether its edges have a direction or not.
The Domain of a Graph
The domain of a graph G, denoted by dom(G), is the set of all vertices that have at least one outgoing edge. In other words, it's the set of all vertices that are the source of at least one directed edge. If G is an undirected graph, then dom(G) is the set of all vertices.

Example
Consider the directed graph G = (V, E), where V = {1, 2, 3, 4} and E = {(1, 2), (2, 3), (3, 1), (4, 2), (4, 3)}. Here, dom(G) = {1, 2, 3, 4}, as every vertex has at least one outgoing edge.
The Range of a Graph
The range of a graph G, denoted by ran(G), is the set of all vertices that have at least one incoming edge. In other words, it's the set of all vertices that are the destination of at least one directed edge. Like the domain, if G is undirected, then ran(G) is the set of all vertices.
Example
Using the same directed graph G, we find ran(G) = {2, 3}, as these are the only vertices with incoming edges.

Range and Domain in Undirected Graphs
In undirected graphs, the concepts of range and domain are less meaningful, as every vertex is both a source and a destination. Therefore, the range and domain of an undirected graph are typically defined as the set of all vertices.
Range and Domain in Strongly Connected Components
However, in directed graphs, the range and domain can provide valuable insights into the graph's structure. Specifically, they can help identify strongly connected components, which are subsets of vertices where every vertex is reachable from every other vertex. The range and domain of a strongly connected component are the same and equal to the set of vertices in the component.
Example
In the directed graph G, the vertices {1, 2, 3} form a strongly connected component with range and domain both equal to {1, 2, 3}.
Range and Domain in Graph Algorithms
The range and domain are also crucial in graph algorithms. For instance, in topological sorting, the domain and range can help identify vertices with no incoming edges (independent vertices) and vertices with no outgoing edges (sinks), respectively. Moreover, the range and domain can help optimize algorithms by eliminating unnecessary computations on vertices with no incoming or outgoing edges.
The range and domain are powerful tools in graph theory, offering unique insights into a graph's structure and behavior. Whether you're analyzing a social network, a computer network, or a biological network, understanding the range and domain can provide valuable insights and help optimize algorithms.