-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigs.py
30 lines (22 loc) · 885 Bytes
/
Configs.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
import networkx as nx
from sknetwork.data import miserables
class Configs:
__dataset = miserables(metadata=True)
__graph_normal = None
__graph_labels = None
@staticmethod
def load_normal_dataset():
if Configs.__graph_normal is None:
Configs.__graph_normal = nx.to_networkx_graph(
Configs.__dataset['adjacency'])
return Configs.__graph_normal
@staticmethod
def load_labels_dataset():
if Configs.__graph_labels is None:
if Configs.__graph_normal is None:
Configs.load_normal_dataset()
names = Configs.__dataset['names']
map = {idx: name for idx, name in enumerate(names)}
Configs.__graph_labels = nx.relabel_nodes(Configs.__graph_normal,
map)
return Configs.__graph_labels