1. A method for finding a decomposition for a primal graph having a number of vertices and a number of edges, the method comprising: in a first stage, building a decomposition of the primal graph, by at least one circuit, given a hardware specific graph, the building by: sequentially adding each vertex in the primal graph to the decomposition, wherein: each vertex in the primal graph is associated with a connected subgraph in a set of connected subgraphs that is a first representation of the decomposition, each edge in the primal graph is represented as a path from a first respective connected subgraph and a second respective connected subgraph, and sequentially adding of a vertex in the primal graph to the decomposition which minimizes a measure of the decomposition via execution of a greedy algorithm; in a second stage, following the first stage, refining, by the at least one circuit, the decomposition created in the first stage by: removing in sequence each vertex from the decomposition, reading the vertex into the decomposition to minimizes the measure of the decomposition; and returning the decomposition.