Boron-carbon-nitride (BCN), a ternary system, enables us to compose a wide variety of novel materials due to their unique mechanical, thermal, and electrical properties. We study two-dimensional structures called nanoflakes made of boron, carbon, and nitrogen atoms arranged in hexagonal lattice structures. The physical properties of these nanostructures, in general, are functions of the overall shape, stoichiometric ratio of boron carbon and nitrogen atoms, and their distribution. In this study, we utilize graph theory to randomly generate these structures, forming three different phases: hexagonal graphene, hexagonal boron nitride, and hexagonal BCN in various proportions. We perform density functional theory (DFT) simulations to obtain the optimized nanoflake structures and analyze the electronic structure. Our results have important implications for future studies of novel materials based on BCN nanoflakes and their experimental realizations.