Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dataset/gran_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ def __init__(self, config, graphs, tag='train'):
def _get_graph_data(self, G):
node_degree_list = [(n, d) for n, d in G.degree()]

adj_0 = np.array(nx.to_numpy_matrix(G))
adj_0 = np.array(nx.to_numpy_array(G))

### Degree descent ranking
# N.B.: largest-degree node may not be unique
degree_sequence = sorted(
node_degree_list, key=lambda tt: tt[1], reverse=True)
adj_1 = np.array(
nx.to_numpy_matrix(G, nodelist=[dd[0] for dd in degree_sequence]))
nx.to_numpy_array(G, nodelist=[dd[0] for dd in degree_sequence]))

### Degree ascent ranking
degree_sequence = sorted(node_degree_list, key=lambda tt: tt[1])
adj_2 = np.array(
nx.to_numpy_matrix(G, nodelist=[dd[0] for dd in degree_sequence]))
nx.to_numpy_array(G, nodelist=[dd[0] for dd in degree_sequence]))

### BFS & DFS from largest-degree node
CGs = [G.subgraph(c) for c in nx.connected_components(G)]
Expand All @@ -91,8 +91,8 @@ def _get_graph_data(self, G):
node_list_bfs += list(bfs_tree.nodes())
node_list_dfs += list(dfs_tree.nodes())

adj_3 = np.array(nx.to_numpy_matrix(G, nodelist=node_list_bfs))
adj_4 = np.array(nx.to_numpy_matrix(G, nodelist=node_list_dfs))
adj_3 = np.array(nx.to_numpy_array(G, nodelist=node_list_bfs))
adj_4 = np.array(nx.to_numpy_array(G, nodelist=node_list_dfs))

### k-core
num_core = nx.core_number(G)
Expand Down
2 changes: 1 addition & 1 deletion utils/arg_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def parse_arguments():
def get_config(config_file, exp_dir=None, is_test=False):
""" Construct and snapshot hyper parameters """
# config = edict(yaml.load(open(config_file, 'r'), Loader=yaml.FullLoader))
config = edict(yaml.load(open(config_file, 'r')))
config = edict(yaml.safe_load(open(config_file, 'r')))

# create hyper parameters
config.run_id = str(os.getpid())
Expand Down