def createGraphs2(subdata, deg):
    avg = 0
    for j in range(len(subdata)):
        matrix = subdata[j]
        threshold = alzTest.findThresh(matrix, deg)
        for k in range(len(subdata[j])):
            for l in range(len(subdata[j][k])):
                if subdata[j][k][l] > threshold:
                    subdata[j][k][l] = 1
                else:
                    subdata[j][k][l] = 0
        G = nx.DiGraph(subdata[j])
        listoflists = nx.kosaraju_strongly_connected_components(G)
        avg += len(listoflists[0])
    return float(avg / len(subdata))
Example #2
0
def createGraphs2(subdata, deg):
  avg = 0
  for j in range(len(subdata)):
    matrix = subdata[j]
    threshold = alzTest.findThresh(matrix, deg)
    for k in range(len(subdata[j])):
      for l in range(len(subdata[j][k])):
        if subdata[j][k][l] > threshold:
          subdata[j][k][l] = 1
        else:
          subdata[j][k][l] = 0
    G = nx.DiGraph(subdata[j])
    listoflists = nx.kosaraju_strongly_connected_components(G)
    avg += len(listoflists[0])
  return float(avg/len(subdata))
def determineThreshold(subdata, deg):
    sum = 0
    for matrix in subdata:
        sum += alzTest.findThresh(matrix, deg)
    return float(sum / len(subdata))
Example #4
0
def determineThreshold(subdata, deg):
  sum = 0
  for matrix in subdata:
    sum += alzTest.findThresh(matrix, deg)
  return float(sum/len(subdata))