The connectivity test of a graph is performed based on the neighbourhoods of all its nodes. The connectivity test starts with enumerating the nodes and setting this as the initial graph enumeration. The enumeration list is updated while checking the neighbour lists node by node. After detecting neighbours of a node, the labellings of the tested node and its neighbours from the graph enumeration list are stored. The minimum value of this set is given as the smallest index of the neighbourhood. This smallest index value is used for updating the list of graph enumeration. The test is terminated once all the nodes have the same label or all the nodes are re-labelled. For example, the connectivity test is performed for an isomer of C 6 H 6 represented by the adjacency matrix A (Figure ) with its initial node enumeration (labels) , {1, 2, 3, 4, 5, 6} The matrix A (Figure ) is connected since the smallest node label for each tested node is1 and its last node enumeration list includes only 1s. Thus there is only one component whose smallest index is 1 (Figure ). For a disconnected chemical graph represented by the adjacency matrix B (Figure ) with its initial node enumeration (labels) . {1, 2, 3, 4, 5, 6} In Algorithm 1, when a matrix is complete and stored in the output file, the generation process continues with the backward function. Here, the last index of the matrix is used as the input. However, with the "learning from connectivity test", the algorithm continues with the last entry of the first component. For example, in matrix B, the first component is and the maximum index is 5. Thus, the graph gets disconnected after the last ς 1 = {1, 2, 5} entry of the fifth row, entry of the matrix B. All the other modifications on the matrix 𝐵 between its last entry [6,6] and build only disconnected graphs. That is why the matrix modification process continues with the last entry of the first component. The learning from the connectivity test reduces the construction of disconnected graphs.