AI Glossary / Graphs and symbolic AI / Intermediate

Cycle

Definition

A cycle is a route through a graph that returns to its starting vertex. In a simple cycle, no other vertex is repeated. For a directed cycle, every edge must be followed in its permitted direction.

What it means

Graphs represent objects as vertices and relationships as edges. A cycle identifies a closed chain of relationships. Its meaning depends on what those relationships represent: a transport cycle can provide an alternative route, while a cycle of strict prerequisites can make a schedule impossible.

A cycle is therefore a structural property, not automatically an error. Feedback controllers, repeated workflows and mutual relationships can legitimately contain cycles. Systems designed as hierarchies or prerequisite orders may forbid them.

Terminology requires care. A closed walk can revisit vertices or edges, whereas a simple cycle avoids those repetitions apart from returning to its start. In a simple undirected graph, traversing one edge out and immediately back is not treated as a two-edge cycle using two distinct edges.

How it works

To interpret a cycle, first identify the graph type and edge meaning. Directed edges might mean that one task depends on another, that money moves from one account to another, or that a search action leads between states. These are different models even if their drawings look similar.

A cycle-detection procedure explores connections and looks for evidence that a route closes. For a directed depth-first search, encountering a vertex still on the active exploration path reveals a directed cycle. Merely reaching a vertex visited in an earlier completed branch is insufficient. For an undirected traversal, the edge back to a vertex's parent needs special handling.

Finding one cycle, deciding whether any cycle exists and listing every simple cycle are distinct tasks. Enumeration can produce an enormous output even when the graph fits comfortably in memory. A length limit or a request for one explanatory example may better suit an operational question.

Conventions for self-loops and parallel edges also matter. Some software counts a self-loop as a length-one cycle and a pair of parallel undirected edges as a length-two cycle. Record the convention rather than comparing counts from different graph representations without checking.

Three practical examples

  • A project scheduler flags a prerequisite chain that eventually requires its own starting task to finish first.
  • A network analyst identifies closed routes that may offer alternatives when a link becomes unavailable.
  • A search program recognizes revisited states so that repeatedly circling through actions does not prevent useful progress.

Think of it this way

Think of following signposted streets until you return to the same intersection. A directed cycle requires every turn to respect the one-way signs. Removing the signs from the drawing can reveal a loop that a driver could never legally complete.

The analogy does not establish what a cycle means in a business graph. An arrow labeled “approves” has a different interpretation from a one-way street.

Worked example

Direction changes the answer

Suppose a graph has vertices Design, Review and Release, with directed edges Design→Review, Design→Release and Review→Release. The arrows mean that the earlier task must finish before the later task starts.

Ignoring arrowheads produces a triangle. However, there is no directed cycle: all routes move toward Release, and no arrow returns to Design. Design, Review, Release is a valid ordering of these prerequisites.

Now add Release→Design. The sequence Design→Review→Release→Design is a directed cycle of length three. Design cannot start until Release finishes, Release cannot finish until its prerequisites are completed, and the chain returns to Design.

There is also a length-two directed cycle Design→Release→Design because the direct Design→Release edge already existed. Reporting just one cycle can demonstrate the defect, but it does not mean that the graph contains only one. Deleting Release→Design removes both of these cycles in this example.

Illustrative case study

A fictional content studio, Linden Media, checks its publication workflow for cycles. The first implementation converts all dependencies into undirected links and reports ordinary converging review paths as faults.

The team revises the check to preserve arrow directions and labels each relationship explicitly as a prerequisite. It then finds a genuine circular requirement: a final approval is needed to create the version that must receive that same final approval.

The studio separates preparation from final approval and checks the revised graph again. It keeps legitimate revision loops in a separate workflow model, where returning for edits has an explicit state transition. This avoids assuming that every repeated activity must be removed from the business process.

Common misconceptions and mistakes

  • Every triangle is a directed cycle. Its arrows may prevent any directed return route.
  • A cycle always signals a bad design. Its significance depends on the represented relationships and requirements.
  • Finding one cycle lists all the problematic relationships. Other cycles may remain after a proposed repair.
  • Revisiting any previously seen vertex proves a directed cycle. The traversal context matters; a shared downstream vertex can be reached without a cycle.

Business use

Cycle checks support dependency management, workflow analysis and graph-based AI search. Define what failure means before selecting the check: an invalid prerequisite loop, an allowed revision process and a suspicious transaction circuit need different interpretations.

When a cycle is flagged, show its actual vertices and edges so an owner can investigate the model. Recheck the whole relevant graph after changing a relationship. Avoid demanding every cycle when one witness or a component-level summary can answer the decision question; a long list may obscure the few dependencies that require attention.

People also ask

Can a graph have cycles and still be connected?

Yes. Connectivity and the presence of cycles are separate properties.

Does a directed acyclic graph have no undirected loops?

Not necessarily. Ignoring directions can reveal an undirected cycle in a graph with no directed cycle.

Is rotating a cycle's starting point a different cycle?

Usually not. Listing A-B-C-A and B-C-A-B describes the same simple cycle under standard enumeration conventions.

Check your understanding

Edges A→B, A→C and B→C form a triangle when arrows are ignored. Must a directed cycle exist?

Answer: No. There is no directed route from C back to A or B. The graph is acyclic in its directed interpretation.

Related terms

  • Graph
  • Directed acyclic graph
  • Simple Paths
  • Cycle cutset
  • simple path
  • closed walk
  • cycle detection
  • strongly connected component

Learn next

Draw three vertices with arrows A→B, A→C and B→C. Add one returning arrow at a time and list the directed cycles it creates. Then explain why your answer changes when all arrows are ignored.

More in Graphs and symbolic AI

  • Curse of dimensionality - The curse of dimensionality describes difficulties that can arise as the number of dimensions in a problem increases.
  • Cutoff test - A cutoff test is a condition that tells a search algorithm to stop expanding a state before the complete underlying problem has necessarily ended.
  • Cutset conditioning - Cutset conditioning is a method for solving a constraint problem by trying assignments to a selected set of variables whose removal leaves an acyclic...
  • Cyclic solution - A cyclic solution is a plan or policy that can return to an earlier state or decision point and repeat actions.
  • CYK algorithm - The CYK algorithm, named for Cocke, Younger and Kasami, is a dynamic programming method for recognizing and parsing strings with a context-free grammar.
  • D* - D*, or Dynamic A*, is an incremental path-planning algorithm that repairs a route when new information changes edge costs in a graph.

Sources

NetworkX documentation defines simple-cycle conventions and distinguishes cycle enumeration from finding a cycle: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cycles.simple_cycles.html

Its find_cycle documentation explains direction handling: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.cycles.find_cycle.html

The prerequisite example and Linden Media case are original illustrations.

Previous: Cybersecurity Next: Cycle cutset

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer