In a previous work [Andrade textit{et al.}, Phys. Rep. textbf{647}, 1 (2016)], it was shown that the exact Greens function (GF) for an arbitrarily large (although finite) quantum graph is given as a sum over scattering paths, where local quantum effects are taken into account through the reflection and transmission scattering amplitudes. To deal with general graphs, two simplifying procedures were developed: regrouping of paths into families of paths and the separation of a large graph into subgraphs. However, for less symmetrical graphs with complicated topologies as, for instance, random graphs, it can become cumbersome to choose the subgraphs and the families of paths. In this work, an even more general procedure to construct the energy domain GF for a quantum graph based on its adjacency matrix is presented. This new construction allows us to obtain the secular determinant, unraveling a unitary equivalence between the scattering Schrodinger approach and the Greens function approach. It also enables us to write a trace formula based on the Greens function approach. The present construction has the advantage that it can be applied directly for any graph, going from regular to random topologies.