original preprocessing for graph analysis