ClearAll["Global`*"]
m = {{0, 1, 1}, {0, 0, 1}, {0, 0, 1}};
test[m_] :=With[{g = AdjacencyGraph[m, VertexLabels -> "Name"]},
If[LoopFreeGraphQ@g == True && AcyclicGraphQ@g == True, "Dogru", {"Yanlis", HighlightGraph[g, Subgraph[g, #] & /@ ConnectedComponents[g]]}]]
test[m]
m={{0, 1, 0, 0, 1, 1, 0, 0}, {1, 0, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0,
1, 0, 1}, {0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 1, 0}, {0, 0,
0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 1, 1,
0}};
test[m]
m = {{0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 1, 1, 0,
0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, {0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0}};
test[m]
Dogru