Fix [un]directed_graph::swap and add tests