Computer scienceAlgorithms and Data StructuresData structuresGraphsGraphs: basics

Nodes, cycles and paths

Directed cycle

Report a typo

Given below is a directed graph:

Directed cycle in the graph

Your task here is to find a simple cycle in the graph. If there are several of them, choose the one with the maximum number of intermediate nodes. Print such a cycle in the field below starting with a node with the smallest label. For example, your answer may look like this:

1 3 2 5 1
Enter a short text
___

Create a free account to access the full topic