Memristive Architectures and Algorithms for Approximate Graph-based Inference