Python

C

Java

Python result:

C result:

Java result:

Adjacency Matrix:

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: True

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: True

Adjacency Matrix:

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: Yes

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: Yes

Adjacency Matrix:

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: true

0 0 1 1 1 0 0

0 0 1 0 0 1 0

1 1 0 0 1 1 1

1 0 0 0 0 0 0

1 0 1 0 0 0 0

0 1 1 0 0 0 0

0 0 1 0 0 0 0

Vertex Data:

Vertex 0: A

Vertex 1: B

Vertex 2: C

Vertex 3: D

Vertex 4: E

Vertex 5: F

Vertex 6: G

Graph has cycle: true