A geometric approach for inference on graphical models