Work with the Facebook friends network provided in file Files/a3/3980.edges and the template Java files provided under the same folder. This is a network of people that are friends with each other. This is an undirected network, since Facebook friend connections are undirected. Each line in the "3980.edges" file is an edge "A B". The opposite edge "BA" also appears somewhere in the file. Therefore, the edges in the "3980.edges" file include a connection from A to B and from B to A to represent undirected edges (friend connections). All people in the "3980.edges" file have some relation with a Facebook user with id 3980 (obviously the real name has been obscured). The Facebook network originated from SNAP. Read this entire connectivity network into an adjacency list. You can use your code from assignment 1 for reading in text files. You can use the Node class provided for assignment 2 with a data type of int, then the adjacency list would be of type Node[]. //initialize array Node] adjacencyList = new Node[max_num_vertices]; //initialize array elements(objects of LinkedList) for (int i=0; i, then the adjacency list would be of type LinkedList []. For example: //initialize array LinkedList[] adjacencyList = new LinkedList[max_num_vertices]; //initialize array elements(objects of LinkedList) for (int j=0; j(); Implement the function areFriends, which checks if 2 Facebook users with ids A and B are friends (this is like the hasEdge function in undirected graphs): boolean areFriends(int A, int B) { }
Work with the Facebook friends network provided in file Files/a3/3980.edges and the template Java files provided under the same folder. This is a network of people that are friends with each other. This is an undirected network, since Facebook friend connections are undirected. Each line in the "3980.edges" file is an edge "A B". The opposite edge "BA" also appears somewhere in the file. Therefore, the edges in the "3980.edges" file include a connection from A to B and from B to A to represent undirected edges (friend connections). All people in the "3980.edges" file have some relation with a Facebook user with id 3980 (obviously the real name has been obscured). The Facebook network originated from SNAP. Read this entire connectivity network into an adjacency list. You can use your code from assignment 1 for reading in text files. You can use the Node class provided for assignment 2 with a data type of int, then the adjacency list would be of type Node[]. //initialize array Node] adjacencyList = new Node[max_num_vertices]; //initialize array elements(objects of LinkedList) for (int i=0; i, then the adjacency list would be of type LinkedList []. For example: //initialize array LinkedList[] adjacencyList = new LinkedList[max_num_vertices]; //initialize array elements(objects of LinkedList) for (int j=0; j(); Implement the function areFriends, which checks if 2 Facebook users with ids A and B are friends (this is like the hasEdge function in undirected graphs): boolean areFriends(int A, int B) { }
Related questions
Question
code
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps