THE LAST ASSIGNMENT
For this assignment you will write a Java program that inputs a file with a description of a social network and computes all agents that will eventually adopt the product under threshold diffusion model after samples are given to a specific group of agents.
The first line of the file will contain a single integer positive number n specifying the total number of agents in the social networks. We use natural numbers to represent these agents. For example, if n=7, then the agents are 0, 1, 2, 3, 4, 5, and 6.
The second line of the input file will contain n numbers of type double separated by spaces that specify threshold values of all agents. For example, if n=3 and the second line contains numbers 1.2 3.4 4.5, then threshold value of agent 0 is 1.2, agent 1 is 3.4, and agent 2 is 4.5.
The third line contains n integer numbers 0 or 1 separated by spaces that specify which agents received free samples and started to use them. For example, if the third line contains numbers 1 0 1, then 0th and 2nd agent received free samples.
The fourth line of the file will contain a single non-negative integer m. It specifies the number of edges in the network.
The rest of the file will contain m lines. Each line will have an integer number followed by a double, followed by an integer number. It specifies the weight assigned to each edge. For example, if a line contains numbers 0 3.2 1, then it means that if agent 0 adopts the product, then it puts peer pressure of 3.2 on agent 1.
Your program should print out a single line in the terminal window that lists numbers (in the increasing order) of all agents who either were given the product to start with, or would adopt it as a result of the diffusion.
If you are given input file
4 1.0 1.0 1.0 1.0 1 0 0 0 3 0 1.2 1 1 1.2 2 2 0.8 3
then your output should be
0 1 2
Use the same submission instruction as before. Good luck!