OBJECT-ORIENTED MODELING OF SOCIAL NETWORK GRAPHS IN JAVA: A GRAPH-BASED APPROACH
Keywords:
Keywords: Object-Oriented Programming, Java, Social Network, Graph Theory, Encapsulation, BFS, DFS, Design Patterns, Adjacency List.Abstract
ABSTRACT
Social networks are among the most widely used software systems in the world,
connecting billions of users through relationships that can be modeled as graphs.
Designing the software behind such systems requires a programming approach that is
organized, flexible, and maintainable. This paper shows how the four principles of
Object-Oriented Programming (OOP) — encapsulation, inheritance, polymorphism,
and abstraction — can be applied in Java to build a graph-based social network model.
A three-layer architecture is proposed, separating user entities, graph structure, and
service logic into distinct components.
The paper implements Breadth-First Search (BFS) and Depth-First Search
(DFS) within an OOP framework and applies three classic design patterns from
Gamma et al. (1994): Observer, Factory, and Iterator. A demonstration with five users
shows how BFS discovers connections and finds shortest paths. The main finding is
that OOP principles make social network graph modeling clean, modular, and easy to
extend. This paper is a course demonstration of OOP design and graph algorithm
competency, not a novel research contribution.
References
REFERENCES
1. Bloch, J. (2018). Effective Java (3rd ed.). Addison-Wesley Professional.
2. Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2009). Introduction to
algorithms (3rd ed.). MIT Press.
3. Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design patterns:
Elements of reusable object-oriented software. Addison-Wesley Professional.
4. Horstmann, C. S. (2022). Core Java: Fundamentals (12th ed., Vol. 1). Oracle Press
/ Addison-Wesley Professional.
5. Sedgewick, R., & Wayne, K. (2011). Algorithms (4th ed.). Addison-Wesley
Professional.
6. Wasserman, S., & Faust, K. (1994). Social network analysis: Methods and
applications.
7. Cambridge University Press. https://doi.org/10.1017/CBO9780511815478