What is a generalized transition graph (GTG)?

A generalized transition graph (GTG) is a graphical representation used when converting regular expressions into finite automata. A GTG provides a structured visual representation of the transitions between states in a finite automaton derived from a given regular expression. It’s particularly useful for understanding the conversion of regular expressions into finite automata.

Each state in a GTG corresponds to a subexpression or a set of subexpressions within the original regular expression. Transitions between states are labeled with regular expressions. These labels describe the possible paths or transitions between different parts of the input string based on the regular expression’s rules. GTGs have accepting states that indicate when the input string matches the corresponding transition’s subexpression.

Properties

A GTG is a collection of the following:

  1. A finite set of states, of which at least one is a start state and some (maybe none) are final states

  2. An alphabet Σ of input letters

  3. Directed edges connecting some pairs of states, each labeled with a regular expression

Examples

For the examples below, Σ=Σ= {a,ba, b}.

  1. A GTG for words without two consecutive bb letters is shown in the figure below. The word bb is not accepted.

Example 1
Example 1

In this GTG, a loop exists at state 11 to accept words with only aa in them. The edge from state 11 to state 22 accepts words encountering a bb followed by an aa (baba) or just a sequence of aa. The edge from state 22 to state 33 either accepts bb or serves as a free ride to the end state (by using the λ\lambda); this allows for words with a single bb to satisfy the criteria without encountering the bbbb sequence.

  1. A GTG for words that begin and end with different letters is shown in the figure below.

Example 2a
Example 2a

In this GTG, the edge from state 11 to state 22 is labeled b(a+b)ab(a+b)*a, indicating that it accepts words that start with bb, followed by zero or more occurrences of aa or bb, and end with aa.

The edge from state 11 to state 33 is labeled a(a+b)ba(a+b)*b, indicating that the GTG also accepts words that start with aa, followed by zero or more occurrences of aa or bb, and end with bb.

Example 2b
Example 2b

This is another example of how the GTG can be represented.

Conclusion

The purpose of a GTG is to provide a structured way to visualize the steps involved in processing a regular expression and recognize the strings that match the given regular expression pattern. It helps illustrate how the regular expression is decomposed into smaller subexpressions and how it’s processed as part of the finite automaton.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved