Implement unidirected graph