This function converts a vector of memberships into a proper vertex partition object.
Examples
m1 <- c("P1", "P3", "P4", "P1", "P2", "P2", "P3", "P1", "P4", "P3")
V1 <- as_vertex_partition(m1)
m2 <- as.integer(c(1, 3, 4, 1, 2, 2, 3, 1, 4, 3))
V2 <- as_vertex_partition(m2)