-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSolver.py
More file actions
25 lines (22 loc) · 730 Bytes
/
Solver.py
File metadata and controls
25 lines (22 loc) · 730 Bytes
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
import time
class Solver:
def __init__(self, G, seeds, k, **params):
if len(G) == 0:
raise Exception("Graph can not be empty")
if len(seeds) == 0:
raise Exception("Seeds can not be empty")
if k > len(G) - len(seeds):
raise Exception("Seeds can not be blocked: too large k")
if k == 0:
raise Exception("k should be greater than 0")
self.G = G.copy()
self.seeds = [int(node) for node in seeds]
self.k = int(k)
self.log = {}
self.log['created'] = time.time()
self.params = params
self.clear()
def clear(self):
pass
def get_name(self):
return self.__class__.__name__