graph adapter from bidirectional to undirected