This paper proposes a new methodology to generate UML class and sequence diagrams from source code and class files using a graph-based clustering approach. It performs keyphrase extraction from source code comments, constructs a source code dependency graph (SDG) based on contextual similarity, and clusters related documents together. Finally, it creates UML diagrams from the filtered top clusters. An analysis of existing UML diagram generation techniques is also provided. The proposed approach is useful for software maintenance engineers and developers to understand project structure for large open source projects.