aboutsummaryrefslogtreecommitdiffstats
path: root/Metrics/Metrics-Calculation/metrics_plot/utils
diff options
context:
space:
mode:
Diffstat (limited to 'Metrics/Metrics-Calculation/metrics_plot/utils')
-rw-r--r--Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py8
-rw-r--r--Metrics/Metrics-Calculation/metrics_plot/utils/constants.py3
-rw-r--r--Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py6
3 files changed, 17 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py
index 41054294..48d96ccc 100644
--- a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py
+++ b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py
@@ -12,6 +12,8 @@ class GraphCollection:
12 self.mpcs = [] 12 self.mpcs = []
13 self.nts = [] 13 self.nts = []
14 self.name = name 14 self.name = name
15 self.tccs = []
16 self.violations = []
15 models = reader.readmultiplefiles(path, number, shouldShuffle) 17 models = reader.readmultiplefiles(path, number, shouldShuffle)
16 print(len(models)) 18 print(len(models))
17 self.size = len(models) 19 self.size = len(models)
@@ -22,6 +24,10 @@ class GraphCollection:
22 self.mpcs.append(mpc) 24 self.mpcs.append(mpc)
23 if(constants.Node_TYPE_KEY in contents): 25 if(constants.Node_TYPE_KEY in contents):
24 self.nts.append(contents[constants.Node_TYPE_KEY]) 26 self.nts.append(contents[constants.Node_TYPE_KEY])
27 if(constants.TCC_VALUE in contents):
28 self.tccs.append(contents[constants.TCC_VALUE])
29 if(constants.VIOLATION in contents):
30 self.violations.append(contents[constants.VIOLATION][0])
25 31
26#Graph stat for one graph 32#Graph stat for one graph
27class GraphStat: 33class GraphStat:
@@ -35,4 +41,6 @@ class GraphStat:
35 self.nodeTypeStat = contents[constants.Node_TYPE_KEY] 41 self.nodeTypeStat = contents[constants.Node_TYPE_KEY]
36 if constants.VIOLATION in contents: 42 if constants.VIOLATION in contents:
37 self.violations = int(contents[constants.VIOLATION][0]) 43 self.violations = int(contents[constants.VIOLATION][0])
44 if(constants.TCC_VALUE_KEY in contents):
45 self.tcc = contents[constants.TCC_VALUE_KEY]
38 46
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py b/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py
index be115a05..e30cc583 100644
--- a/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py
+++ b/Metrics/Metrics-Calculation/metrics_plot/utils/constants.py
@@ -30,3 +30,6 @@ HUMAN_NA_REP = '../input/humanOutput/R_2017419_run_1.csv'
30 30
31VIOLATION = 'violations' 31VIOLATION = 'violations'
32 32
33TCC_VALUE= 'TCCValue'
34
35TCC_COUNT = 'TCCCount'
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py b/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py
index 394168d8..a56caf45 100644
--- a/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py
+++ b/Metrics/Metrics-Calculation/metrics_plot/utils/readCSV.py
@@ -33,6 +33,8 @@ def readcsvfile(filename):
33 #convert number to floats 33 #convert number to floats
34 numbers = [float(n) for n in numbers] 34 numbers = [float(n) for n in numbers]
35 contents[constants.Node_TYPE_KEY] = {t : n for t, n in zip(types, numbers)} 35 contents[constants.Node_TYPE_KEY] = {t : n for t, n in zip(types, numbers)}
36 elif(arr[0] == constants.TCC_VALUE):
37 contents[constants.TCC_VALUE] = list(map(float, arr[1:]))
36 # NA and OD are integers, and store other information as string 38 # NA and OD are integers, and store other information as string
37 else: 39 else:
38 try: 40 try:
@@ -79,6 +81,10 @@ def getmetrics(filename):
79 outdegree_sample = reproduceSample(contents[constants.OUT_DEGREE_VALUE], contents[constants.OUT_DEGREE_COUNT]) 81 outdegree_sample = reproduceSample(contents[constants.OUT_DEGREE_VALUE], contents[constants.OUT_DEGREE_COUNT])
80 na_sample = reproduceSample(contents[constants.NA_VALUE], contents[constants.NA_COUNT]) 82 na_sample = reproduceSample(contents[constants.NA_VALUE], contents[constants.NA_COUNT])
81 mpc_sample = reproduceSample(contents[constants.MPC_VALUE], contents[constants.MPC_COUNT]) 83 mpc_sample = reproduceSample(contents[constants.MPC_VALUE], contents[constants.MPC_COUNT])
84
85 if(constants.TCC_VALUE in contents):
86 contents[constants.TCC_VALUE] = reproduceSample(contents[constants.TCC_VALUE], contents[constants.TCC_COUNT])
87
82 return contents,outdegree_sample, na_sample, mpc_sample 88 return contents,outdegree_sample, na_sample, mpc_sample
83 89
84# 90#