Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:06:51+00:00 2026-05-27T09:06:51+00:00

I have a Social Graph assignment, and I have a pretty good idea of

  • 0

I have a Social Graph assignment, and I have a pretty good idea of what I want to do, I just want to know if I’m on the right track, and any hints you guys can provide.

Anyway, fairly simple implementation (I found a very complex one here – How to model social graph in Java, but I think it’s far more than what I actually need). Essentially my idea is to make a “User” object and a hashmap to keep everything in. A User object will have 4 data structures within it – name (string), student (boolean), school (string), and friends (integer array).

Each user will be added to the hashmap, and thus given a unique key. When a friendship is to be made, say between A and B, I go to the user A in the hashmap and ad the key for user B into A’s friends array, and vice versa. That way I can keep track of everyone and who they’re friends with.

Does this make sense? It works out in my head, but I feel like I’m missing something in the implementation that will make this not work as well as I think it should.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:06:52+00:00Added an answer on May 27, 2026 at 9:06 am

    The answer to this will depend on the requirements and what you want to do with your social graph (especially on whether you want to persist the data or not).

    If you are using a hashmap as your user store, then I assume you have a separate class that is generating your ids (or you have a UserStore class that wraps the hashmap and generates them)? If you are not deleting users, then you could suffice to have an ArrayList as you store, with the index being the user key.

    When it comes to the users themselves, you could hold their friends in a List, but that may complicate your delete user code slightly (assuming you have that functionality).

    UPDATE:

    If you want to do analysis, then you may get some benefit from storing a User’s friends as a Set<“UserKey”> instead of as an array (but depends on how you plan to do your analysis). You would still need a counter class (or master UserStore class that assigns the ids).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a random undirected social graph. I want to find a Hamiltonian path
We have social graph that is later broken to clusters of high cohesion. Something
I am creating a Django app and want to have visualizations of a social
I have read a lot of stuff about the Open Graph Protocol and Social
I have a social application and I would appreciate being pointed into the right
I have a social community built in Django, and i want to add a
I have received the task to make a social graph , where, with one
We have a social site, and want to integrate facebook connect to save time
I just created an app on Facebook (Open Graph). I want to publish a
I have graph of friendship of one social network with about 1.5 million of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.