Added cycle detection function: has_cycles
Minor code improvements
Implemented support for undirected graphs/edges