diff options
Diffstat (limited to 'Metrics/Metrics-Calculation/metrics_plot/src/GraphType.py')
-rw-r--r-- | Metrics/Metrics-Calculation/metrics_plot/src/GraphType.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/metrics_plot/src/GraphType.py b/Metrics/Metrics-Calculation/metrics_plot/src/GraphType.py new file mode 100644 index 00000000..b3c9f359 --- /dev/null +++ b/Metrics/Metrics-Calculation/metrics_plot/src/GraphType.py | |||
@@ -0,0 +1,27 @@ | |||
1 | import readCSV as reader | ||
2 | import constants | ||
3 | import numpy as np | ||
4 | |||
5 | # graph stats for a collection of graphs | ||
6 | class GraphCollection: | ||
7 | |||
8 | # init with path contrain files and number of files to read reader is imported from (readCSV) | ||
9 | def __init__(self, path, number, name, shouldShuffle = True): | ||
10 | self.out_ds = [] | ||
11 | self.nas = [] | ||
12 | self.mpcs = [] | ||
13 | self.name = name | ||
14 | models = reader.readmultiplefiles(path, number, shouldShuffle) | ||
15 | for i in range(len(models)): | ||
16 | contents, out_d, na, mpc = reader.getmetrics(models[i]) | ||
17 | self.out_ds.append(out_d) | ||
18 | self.nas.append(na) | ||
19 | self.mpcs.append(mpc) | ||
20 | |||
21 | #Graph stat for one graph | ||
22 | class GraphStat: | ||
23 | # init with teh file name of the stat | ||
24 | def __init__(self, filename): | ||
25 | contents, self.out_d, self.na, self.mpc = reader.getmetrics(filename) | ||
26 | self.num_nodes = np.array(contents[constants.NUMBER_NODES]) | ||
27 | self.id = (contents[constants.STATE_ID])[0] | ||