Skip to content

MultiverseLearningProducts/social-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Unit 4: Building a Social Network Connection System

Overview

This Skillable lab activity requires you to implement a social network system that uses graphs to represent user connections, find mutual friends, discover connection paths between users, and recommend connections.

Learning Objectives

  • Implement graph data structures using adjacency list representation
  • Implement BFS traversal algorithm for finding paths
  • Find mutual friends using graph intersection techniques
  • Implement friend recommendation algorithm based on mutual connections
  • Optimize solutions for handling large user bases efficiently
  • Use Github Copilot effectively for code generation and exploration

Context

You're building a social network system that needs to:

  • Represent user connections using a graph structure (undirected graph)
  • Find paths between users using graph traversal algorithms
  • Identify mutual friends between users
  • Recommend connections based on mutual friends and graph analysis
  • Handle large user bases efficiently

Project Structure

src/main/java/com/jse/socialnetwork/
├── User.java                  # User data class
├── SocialNetwork.java         # Main graph implementation
└── FriendRecommendation.java  # Recommendation algorithm

src/test/java/com/jse/socialnetwork/
└── SocialNetworkTest.java    # Test cases

Requirements

1. Graph Structure Implementation

  • Use adjacency list representation for the graph
  • Implement undirected graph (friendships are bidirectional)
  • Support adding users and connections
  • Efficient neighbor lookup

2. BFS Path Finding

  • Implement BFS traversal algorithm
  • Find shortest path between two users
  • Handle disconnected users (no path exists)
  • Return path as list of user IDs

3. Mutual Friends

  • Find all mutual friends between two users
  • Use graph intersection techniques
  • Return list of mutual friend user IDs
  • Handle cases where users have no mutual friends

4. Friend Recommendations

  • Recommend friends based on mutual connections
  • Consider users who are friends of friends
  • Rank recommendations by number of mutual friends
  • Return top N recommendations

5. Performance Optimization

  • Efficient graph representation (adjacency list)
  • Optimized BFS implementation
  • Efficient mutual friend calculation
  • Memory management for large networks

6. Github Copilot Integration

  • Use Copilot to explore implementation options
  • Generate helper methods with Copilot
  • Validate and understand Copilot suggestions
  • Document Copilot usage in code comments

Implementation Steps

  1. Implement graph structure - Create adjacency list representation
  2. Implement BFS traversal - Find paths between users
  3. Find mutual friends - Use graph intersection
  4. Implement recommendations - Algorithm based on mutual connections
  5. Use Github Copilot - Explore options and generate code
  6. Optimize performance - Apply optimization techniques
  7. Test and validate - Run tests and validate Copilot suggestions

Testing

Run the provided test cases:

mvn test

Resources

  • Social network framework provided
  • User connection dataset
  • System requirements document
  • Github Copilot access
  • Code examples for reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages