Skip to content

Commit 9d06f67

Browse files
committed
minor cleaning!
1 parent 66ec7b8 commit 9d06f67

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

utils/near_wc_tm.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import igraph
77
import numpy as np
88

9-
from networkx import nx
109
from utils import shortest_path
1110

1211

@@ -43,7 +42,7 @@ def get_longest_matching_traffic_matrix(topology, tor_list, demand_dict):
4342
s = np.array(list(demand_dict.values()), order='F', dtype=np.uint16) * \
4443
(np.ones((num_nodes, num_nodes), order='F', dtype=np.uint16) - np.eye(num_nodes, order='F', dtype=np.uint16))
4544
minimum = np.min(np.array(list(demand_dict.values())))
46-
coefficient = np.minimum(s, np.transpose(s))/minimum
45+
coefficient = np.minimum(s, np.transpose(s)) / minimum
4746
weights = np.reshape(np.multiply(np_shortest_path, coefficient, dtype=np.float32, order='F'),
4847
(1, num_nodes * num_nodes), order='F').tolist()[0]
4948
del s

utils/shortest_path.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def sum_all_pair_shortest_path_length_adjacency_matrix(g):
2222
B = np.eye(num_node, order='F', dtype=np.float32)
2323
total_sp = num_node * (num_node - 1) - num_node
2424
C = np.zeros(np.shape(A), order='F', dtype=np.float32)
25-
for k in range(num_node - 1):
25+
for _ in range(num_node - 1):
2626
B = scipy.linalg.blas.sgemm(1, B, A)
2727
C = np.add(C, B)
2828
num = np.count_nonzero(C == 0)
@@ -52,7 +52,7 @@ def all_pair_shortest_path_length_adjacency_matrix(g, tor_list=None):
5252
C = np.eye(num_node, order='F', dtype=np.float32)
5353
shortest_path_np_array = np.ones(np.shape(A), order='F', dtype=np.float32)
5454

55-
for k in range(num_node - 1):
55+
for _ in range(num_node - 1):
5656
B = scipy.linalg.blas.sgemm(1, B, A)
5757
C = np.add(C, B)
5858
if np.count_nonzero(C == 0) == 0:

0 commit comments

Comments
 (0)