Build a sample engine based on graph theory