Main pocessing code for generate graphs