graph now stored in arrays