Transitivity of directed graph#5079

Transitivity of directed graph

1 sekunt
128 megabaýt
Örän ýeňil

A directed graph is called transitive if, for any three distinct vertices , , and , whenever there are edges from to and from to , there is also an edge from to .

Check whether the given directed graph is transitive.

Giriş

The first line contains the number of vertices (1 \le n \le 100) in the graph. The next lines contain the adjacency matrix of the graph.

Çykyş

Output "YES" if the graph is transitive, and "NO" otherwise.

Mysallar

1-nji mysal

Loading
Loading