proc make_can_move_graph(G:UnWeightedDirectedGraph):UnWeightedDirectedGraph=
var newG = initUnWeightedDirectedGraph(len(G))
for i in range(len(G)):
var alr = initHashSet[int]()
proc dfs(x:int)=
for y in G[x]:
if y notin alr:
alr.incl(y)
newG.add_edge(i,y)
if y != i:
dfs(y)
dfs(i)
return newG
N回DFSなら