-
Notifications
You must be signed in to change notification settings - Fork 0
/
cache.py
executable file
·31 lines (26 loc) · 900 Bytes
/
cache.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import argparse
import sys
import util
import estimator
import config
parser = argparse.ArgumentParser(description='Generating caches.')
parser.add_argument('-g', '--graph', metavar='graph name', dest="name")
parser.add_argument('-M', '--method', metavar='method', dest="method")
args = parser.parse_args()
if not args.name:
print("graph not given!", file=sys.stderr)
sys.exit(0)
graphs = ['growing_network', 'wiki-Vote', 'soc-Slashdot0811', 'cit-HepPh']
if args.name not in graphs:
print("graph name incorrect!", file=sys.stderr)
sys.exit(0)
elif args.method:
if args.method not in ['b1', 'b2', 'TSC', 'LRC']:
print("method name incorrect!", file=sys.stderr)
sys.exit(0)
G = util.load_graph(args.name)
config.dynamic["graph_name"] = args.name
estimator._sampling(G, 'linear1', args.method)
else:
util.load_graph(args.name)