Graph datastructure and processing algorithms