This document aims at reviewing the different types of clustering algorithms and substructures detection techniques in order to study the spatial and kinematic clustering of stars and detect the gas components in molecular clouds. It is the deliverable: Report on Optimal Substructure Techniques for Stellar, Gas and Combined Samples, for the EU H2020 (COMPET-5-2015 - Space) project (A Gaia and Herschel Study of the Density Distribution and Evolution of Young Massive Star Clusters), Grant Agreement Number: 687528, with abbreviated code name StarFormMapper (SFM) project. The document is organized in the following sections: 1. General Introduction 2. Clustering of Discrete Distributions 3. Clustering of Continuous Distributions 4. Clustering in Astrophysics 5. StarFormMapper 6. Summary and Conclusions