cycle - How can I specify whether the input graph is directed or undirected?