Algorithm and data structures for sampling of large graphs