Store the graph however you think is advantageous but

Info icon This preview shows pages 3–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Store the graph however you think is advantageous, but take time to consider how you want to do this. This will affect the remainder of your project, so make sure you choose a good design (and you may want to look over the rest of the project as well). JSON files that FakebookReader will parse will be in the following format: each entry in the top-level JSON object represents a user. Each key is a (unique) user ID (a first-degree friend) and 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
each value is a JSON object with two keys: friends and name . name is the name of the user spec- ified by the user ID given in the key, represented as a string. friends is an array of objects each representing a second-degree friend, each having a key name (the name of the friend as a string) and id (the ID of the friend as a string). Feel free to refer to the sample documents and code in the provided files when you are writing and testing your implementation. Note: for BFS traversal in iterator(), edge weight should only affect the traversal as a way of determining order for insertion into the Queue, and otherwise the algorithm is the same as on unweighted graphs. Note 2: It should be clear that we are generating an *undirected* graph. Though each friend has a weighted edge to all his other friends, and those friends all have weighted edges back to him (via the friends HashMap in Friend.java), these edges have the same weight, and represent the *same* edge. We have provided for you two JSON files, one with 5 nodes and one with 300. Test your code with both. The data is taken from one of the TAs (Shaanan’s) Facebook account and anonymized. The node representing him should be set as your root node unless otherwise stated in the problem specifications. 2.3 ConnectedComponentFinder.java 30pts We will now find the connected components of the graph. The following method, in ConnectedComp- onentFinder.java , returns the connected component of a given node srcNode : public Set<Friend> findCC(Friend srcNode) If srcNode cannot be found in the graph, throw an IllegalArgumentException. Use a breadth- first search to find the vertices in the connected component. Using your ConnectedComponentFinder , fill in the final two methods in FakebookReader.java. Do you see what the difference is between these two sets of connected components? Place your answer in Questions.txt from Phase 4. 4
Image of page 4
3 Phase 2: Graph Metrics, 140pts total This section of the project composes the bulk of your work, and will involve numerous design choices on your part that will drastically affect the runtime and difficulty of the work ahead. The strongest advice we can give you for completing this in a timely manner is to plan ahead . Write out in pseudocode what your code will look like, so that you don’t spend hours implementing a potentially wrong solution. 3.1 MSTKruskal.java 45pts First, implement Kruskal’s algorithm in order to finding a minimum spanning tree. To reiterate what you have learnt / will learn in class, a spanning tree is a subgraph S of a connected, weighted graph G such that for all u in G, u is an element of S connected to all v in S. A minimum spanning tree is a spanning tree with the minimal weight across all its edges.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern