Approximate Pattern Matching Using Hierarchical Graph Construction and Sparse Distributed Representation