Add a sparse2adjacencylist function

Perhaps the name is too long, feel free to change it.