Pixel and Voxel Representations of Graphs