# Network Loops

Simple
English

A routing loop is a common problem with computer networks. Loops are virtually the same as cycles in graphs. For this mission, we’ll learn how to find these cycles in a network.

A cycle consists of a sequence of nodes starting and ending on the same node without repetition and with each consecutive node in the sequence connecting to each other in the network. The cycle length is the quantity of nodes within the cycle. The length of cycle will always be greater than 2. You should find the largest cycle in a given network, determine if we have multiple equal sized loops, then choose any one of them.

The nodes in the network are numbered and each connection is undirected. The length of the edges are not substantial, so consider them to be of equal length. Some components of a network can be disconnected.

The network is represented as a sequence of connections. Each connection is described by the two two numbers representing the connected nodes. The result should be given as a sequence of numbers which start and end with the same number. If there is no cycle, then return an empty sequence.

For example this image will be described as: ((1,2),(2,3),(3,4),(4,5),(5,7),(7,6),(8,5),(8,4),(8,1),(1,5),(2,4)). And the biggest loop have 6 nodes. It can be described as [1,2,3,4,5,8,1] (or [3,4,5,8,1,2,3]).

Input: Connection information as a tuple of tuples of integers.

Output: The largest cycle, or any one of the largest cycles as a list/tuple of integers.

Example:

How it is used: Cycle detection is important for computer networking and may even be applied in the detection of deadlocks in concurrent programming.

Precondition:
all([(n2, n1) in connections for n1, n2 in connections)

45
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
•  to Run Code: to Check Solution: to Stop:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.