- #1

- 125

- 0

## Homework Statement

Sorry about the basic question, I havent takena course on graph theory yet but need this for a course in computer science.

The problem: Write a program whose input is an adjecancy matrix and whose output is the number of cycles of length 3 and 4.

## The Attempt at a Solution

So i figured out that raising the matrix to the nth power will give me the number of paths of length n that will take me from point a to point b.

But what is a cycle? I thought it might be the diagnol but I think I'd be counting paths that go backa nd forth between two points.

So what is a cycle, and what does it look like on a matrix?

Thanks

Tal