Data modeling with graph theory