1. A computer-executable method for generating a product recommendation, comprising: receiving graph data indicating vertices and edges of the graph, wherein the vertices represent customers and products and the edges represent purchases; receiving a query of the graph to determine a product recommendation; generating a finite-state machine (FSM) based on the query; executing the query; determining whether a current state of the FSM is a traversal state; in response to the current state being a traversal state, generating a traversal FSM; searching the traversal FSM for a nearest future traversal state; generating a bitmask for the future traversal state; and utilizing the generated bitmask when executing the future traversal state to generate the product recommendation.
3. The method of claim 1 , wherein the query of the graph is expressed with a declarative language.