/** 
 * @author gswong
 */
 
import java.io.*;
import java.util.*;

public class DetGraph {
    public static void printGraph(double[][] array) {
        int n = array.length;
        
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }
    }
    
    // Add up biases kind of like expected value
    // Each person multiplies his bias toward a given friend by
        // 1 if the friend uses the product
        // 0 if the friend does not use the product
    public static void runSim(double[][] bias, double[] thresh,
        int[] adopted) {
        
        int n = bias.length;
        
        for(int steps = 0; steps < n; steps++) {
            for(int i = 0; i < n; i++) {
                double totalBias = 0.0;
                for(int j = 0; j < n; j++) {
                    if(adopted[j] == 1)
                        totalBias += bias[i][j];
                }
                if(totalBias > thresh[i])
                    adopted[i] = 1;
            }
        }
    }
}
