This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ArrayComponents

ArrayComponents[array]
gives an array in which all identical elements of array are replaced by an integer index representing the component in which the element lies.
ArrayComponents
finds the identical elements at the specified level in array.
  • ArrayComponents returns a label matrix where identical elements are represented by consecutive non-negative integers.
  • Occurrences of zeros or None in array are always labeled with zeros.
Components in a symbolic array:
Components in the first level of an array:
Label identical elements in a list:
Components in a symbolic array:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
 
Components in the first level of an array:
In[1]:=
Click for copyable input
Out[1]=
 
Label identical elements in a list:
In[1]:=
Click for copyable input
Out[1]=
ArrayComponents works with arbitrarily nested lists of symbols:
Normalize a label matrix with missing labels:
New in 8