Graph-based document analysis system