We develop a method for testing the equality of two or more distributions of random vectors with categorical components. We define a function that gives a distance between any two data vectors. Each observed data vector is linked with its nearest neighbor(s). The test statistic is the number of edges linking observations from different distributions. Inference is conditional on the number of observations from each distribution and the number of times each of the data vectors is observed in the pooled sample. Permutation testing and asymptotics are used to estimate the observed significance level. © 2001 Elsevier Science B.V. All rights reserved.