For creating structures in DOLFINx, there are several things at play.
Mesh data is read in (cell-node connectivity and node coordinates), and these are distributed over M processes with a graph partitioner. This will try to find an optimal partitioning of the cells, minimizing communication.
Once the cells have been partitioned (and ghost information has been distributed), one has to assign ownership (and renumber) the mesh nodes, such that those owned by process 0 is numbered [0, M-1] those owned by process 2 is numbered [M, N-1], etc.
Nodes that are on a process and not owned is assigned to the index map as ghosts.
Similar procedure for the vertices (a subset of mesh nodes if the geometry is higher order).
Any other structure that needs an index map is based of these initial partitions, with suitable amounts of ghosts included.
This is for instance done for creating point cloud meshes in:
where there is no ghosting in construction.
This is also used (with ghosting) in the internals of DOLFINx MPC, where one adds additional ghost information between processes depending on the multi-point constraint and partitioning.