{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

project

Additionally you will want to read the documentation

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Additionally, you will want to read the documentation for the GSON class JsonReader before you get started. Pay attention to the beginObject and endObject methods (to use a JsonReader, you will have to import com.google.gson.stream.JsonReader). 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 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 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....
View Full Document

{[ snackBarMessage ]}

Page3 / 10

Additionally you will want to read the documentation for...

This preview shows document pages 3 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online