Skip to content

Commit ed4ead9

Browse files
committed
networkx >=2.7 instead
1 parent e2333db commit ed4ead9

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ If you notice anything unexpected, please open an [issue](https://github.com/She
246246

247247
**Installation**
248248

249-
Binaries are provided for Python version >= 3.7 and NetworkX version < 2.7.
249+
Binaries are provided for Python version >= 3.7 and NetworkX version >= 2.7.
250250

251251
After installing [PyTorch](https://pytorch.org/get-started/locally/) and [PyG](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html), simply run
252252

docs/source/notes/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Installation
22
============
33

44
The installation of PyTorch Geometric Signed Directed requires the presence of certain prerequisites. These are described in great detail in the installation description of PyTorch Geometric. Please follow the instructions laid out `here <https://pytorch-geometric-signed-directed.readthedocs.io/en/latest/notes/installation.html>`_. You might also take a look at the `README file <https://github.com/SherylHYX/pytorch_geometric_signed_directed>`_ of the PyTorch Geometric Signed Directed repository.
5-
Binaries are provided for Python version >= 3.7, PyG version at least 2, and NetworkX version earlier than 2.7.
5+
Binaries are provided for Python version >= 3.7, PyG version at least 2, and NetworkX version no earlier than 2.7.
66

77
After installing `PyTorch <https://pytorch.org/get-started/locally/>`_ and `PyG <https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html>`_, simply run
88

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scikit-learn",
1212
"torch_geometric",
1313
"numpy",
14-
"networkx<2.7",
14+
"networkx>=2.7",
1515
"scipy"
1616
]
1717

torch_geometric_signed_directed/data/signed/polarized_SSBM.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def polarized_SSBM(total_n: int = 100, num_com: int = 3, N: int = 30, K: int = 2
115115
conflict_groups[perm[i]] = conflict_groups_old[i]
116116
# now fix the network connectedness and degree
117117
# first we fix connectedness
118-
G = nx.from_scipy_sparse_matrix(large_A_p-large_A_n)
118+
G = nx.from_scipy_sparse_array(large_A_p-large_A_n)
119119
largest_cc = max(nx.connected_components(G), key=len)
120120
A_p_new = sp.lil_matrix(large_A_p[list(largest_cc)][:, list(largest_cc)])
121121
A_n_new = sp.lil_matrix(large_A_n[list(largest_cc)][:, list(largest_cc)])

torch_geometric_signed_directed/utils/general/extract_network.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ def extract_network(A: sp.spmatrix, labels: Union[np.array, LongTensor, None] =
2121
* **A** (scipy sparse matrix) - Adjacency matrix after fixing degrees and obtaining a connected netework.
2222
* **labels** (numpy array) - Node labels after fixing degrees and obtaining a connected netework.
2323
"""
24-
G = nx.from_scipy_sparse_matrix(A, create_using=nx.DiGraph)
24+
G = nx.from_scipy_sparse_array(A, create_using=nx.DiGraph)
2525
largest_cc = max(nx.weakly_connected_components(G))
2626
A_new = A[list(largest_cc)][:, list(largest_cc)]
2727
labels_new = None
2828
if labels is not None:
2929
labels_new = labels[list(largest_cc)]
30-
G0 = nx.from_scipy_sparse_matrix(A_new, create_using=nx.DiGraph)
30+
G0 = nx.from_scipy_sparse_array(A_new, create_using=nx.DiGraph)
3131
flag = True
3232
iter_num = 0
3333
keep = []
@@ -47,7 +47,7 @@ def extract_network(A: sp.spmatrix, labels: Union[np.array, LongTensor, None] =
4747
lowest_degree -= 1
4848
print('Nothing to keep, reducing lowest_degree by one to be {}!'.format(
4949
lowest_degree))
50-
G0 = nx.from_scipy_sparse_matrix(
50+
G0 = nx.from_scipy_sparse_array(
5151
A_new, create_using=nx.DiGraph)
5252
break
5353

torch_geometric_signed_directed/utils/general/link_split.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def link_class_split(data: torch_geometric.data.Data, size: int = None, splits:
238238
A_undirected = to_scipy_sparse_matrix(undirect_edge_index)
239239
if maintain_connect:
240240
assert ratio == 1, "ratio should be 1.0 if maintain_connect=True"
241-
G = nx.from_scipy_sparse_matrix(
241+
G = nx.from_scipy_sparse_array(
242242
A_undirected, create_using=nx.Graph, edge_attribute='weight')
243243
mst = list(tree.minimum_spanning_edges(
244244
G, algorithm="kruskal", data=False))

0 commit comments

Comments
 (0)