pyg-nightly 2.7.0.dev20250502__py3-none-any.whl → 2.7.0.dev20250504__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/METADATA +1 -1
- {pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/RECORD +8 -7
- torch_geometric/__init__.py +1 -1
- torch_geometric/datasets/__init__.py +2 -0
- torch_geometric/datasets/city.py +156 -0
- torch_geometric/sampler/neighbor_sampler.py +3 -2
- {pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/WHEEL +0 -0
- {pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/licenses/LICENSE +0 -0
{pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pyg-nightly
|
3
|
-
Version: 2.7.0.
|
3
|
+
Version: 2.7.0.dev20250504
|
4
4
|
Summary: Graph Neural Network Library for PyTorch
|
5
5
|
Keywords: deep-learning,pytorch,geometric-deep-learning,graph-neural-networks,graph-convolutional-networks
|
6
6
|
Author-email: Matthias Fey <matthias@pyg.org>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
torch_geometric/__init__.py,sha256=
|
1
|
+
torch_geometric/__init__.py,sha256=sQzmkvhoO3gUcLkGhTtJi5ZIApfl_-Dnsejf7c1o9RI,1978
|
2
2
|
torch_geometric/_compile.py,sha256=f-WQeH4VLi5Hn9lrgztFUCSrN_FImjhQa6BxFzcYC38,1338
|
3
3
|
torch_geometric/_onnx.py,sha256=V9ffrIKSqhDw6xUZ12lkuSfNs48cQp2EeJ6Z19GfnVw,349
|
4
4
|
torch_geometric/backend.py,sha256=lVaf7aLoVaB3M-UcByUJ1G4T4FOK6LXAg0CF4W3E8jo,1575
|
@@ -55,7 +55,7 @@ torch_geometric/data/temporal.py,sha256=WOJ6gFrTLikaLhUvotyUF5ql14FkE5Ox3hNkdSp6
|
|
55
55
|
torch_geometric/data/view.py,sha256=XjkVSc-UWZFCT4DlXLShZtO8duhFQkS9gq88zZXANsk,1089
|
56
56
|
torch_geometric/data/lightning/__init__.py,sha256=w3En1tJfy3kSqe1MycpOyZpHFO3fxBCgNCUOznPA3YU,178
|
57
57
|
torch_geometric/data/lightning/datamodule.py,sha256=Bn9iaIfE4NWDDWWMqCvBeZ4bIW1Silx_Ol5CPJCliaQ,29242
|
58
|
-
torch_geometric/datasets/__init__.py,sha256=
|
58
|
+
torch_geometric/datasets/__init__.py,sha256=fgJgc2wztjTJKczuHwXH7L0CgCXw69o_Dtm1KnleMCY,6235
|
59
59
|
torch_geometric/datasets/actor.py,sha256=oUxgJIX8bi5hJr1etWNYIFyVQNDDXi1nyVpHGGMEAGQ,4304
|
60
60
|
torch_geometric/datasets/airfrans.py,sha256=212gYsk7PvF-qcmvM2YXaOBhFrS79evAGg_sPHXih4w,5439
|
61
61
|
torch_geometric/datasets/airports.py,sha256=b3gkv3gY2JkUpmGiz36Z-g7EcnSfU8lBG1YsCOWdJ6k,3758
|
@@ -71,6 +71,7 @@ torch_geometric/datasets/ba_shapes.py,sha256=sJEQiK3CGlYTdbQBgKeLhO6mY-HRv3nS9Ya
|
|
71
71
|
torch_geometric/datasets/bitcoin_otc.py,sha256=olrsq_Z306-oo17iEQoVif3-CgVIOyVc8twgIMXE0iI,4399
|
72
72
|
torch_geometric/datasets/brca_tgca.py,sha256=2lX9oY6T7aPut8NbXFMWS1c2-_FHqCB4hqUzP4_zFsk,3962
|
73
73
|
torch_geometric/datasets/citation_full.py,sha256=5WT6_iZ1GWuShuYZJErQ3bWNV4bHwZsYYBYztoTxMzs,4458
|
74
|
+
torch_geometric/datasets/city.py,sha256=9EFbPDFlEweVYvZL9V4jmuY_wioKTcax0YxeisZbis4,5138
|
74
75
|
torch_geometric/datasets/coauthor.py,sha256=Nma9aLapDE1S7lCC40WazQZbBJ8nMQV3JJZRci-F3XQ,3138
|
75
76
|
torch_geometric/datasets/coma.py,sha256=4URaPuXdUJdtZbzWojR-BqxlTyykjtvmXptk3G2Uy9k,4734
|
76
77
|
torch_geometric/datasets/cornell.py,sha256=i6wUr2m1U3HCaqMzi-0AZ3Nthdne6_t0ja8qCKYESzE,5311
|
@@ -513,7 +514,7 @@ torch_geometric/profile/utils.py,sha256=7h6vzTzW8vv-ZqMOz2DV8HHNgC9ViOrN7IR9d3BP
|
|
513
514
|
torch_geometric/sampler/__init__.py,sha256=0h_xJ7CQnlTxF5hUpc81WPQ0QaBtouG8eKK1RzPGA-s,512
|
514
515
|
torch_geometric/sampler/base.py,sha256=glbuSNcI0A_y-O3x29jqQpSSqSWxUDKJk5vM8uVF8Gs,26980
|
515
516
|
torch_geometric/sampler/hgt_sampler.py,sha256=UAm8_wwzEcziKDJ8-TnfZh1705dXRsy_I5PKhZSDTK8,2721
|
516
|
-
torch_geometric/sampler/neighbor_sampler.py,sha256=
|
517
|
+
torch_geometric/sampler/neighbor_sampler.py,sha256=G3pw3IHSAPEVeepiw-vJeWDbQwpEW9jr4-Ms_HjcZCA,34080
|
517
518
|
torch_geometric/sampler/utils.py,sha256=RJtasO6Q7Pp3oYEOWrbf2DEYuSfuKZOsF2I7-eJDnoA,5485
|
518
519
|
torch_geometric/testing/__init__.py,sha256=m3yp_5UnCAxVgzTFofpiVt0vdbl5GwVAve8WTrAaNxo,1319
|
519
520
|
torch_geometric/testing/asserts.py,sha256=DLC9HnBgFWuTIiQs2OalsQcXGhOVG-e6R99IWhkO32c,4606
|
@@ -636,7 +637,7 @@ torch_geometric/utils/undirected.py,sha256=H_nfpI0_WluOG6VfjPyldvcjL4w5USAKWu2x5
|
|
636
637
|
torch_geometric/visualization/__init__.py,sha256=b-HnVesXjyJ_L1N-DnjiRiRVf7lhwKaBQF_2i5YMVSU,208
|
637
638
|
torch_geometric/visualization/graph.py,sha256=PoI9tjbEXZVkMUg4CvTLbzqtEfzUwMUcsw57DNBEU0s,14311
|
638
639
|
torch_geometric/visualization/influence.py,sha256=CWMvuNA_Nf1sfbJmQgn58yS4OFpeKXeZPe7kEuvkUBw,477
|
639
|
-
pyg_nightly-2.7.0.
|
640
|
-
pyg_nightly-2.7.0.
|
641
|
-
pyg_nightly-2.7.0.
|
642
|
-
pyg_nightly-2.7.0.
|
640
|
+
pyg_nightly-2.7.0.dev20250504.dist-info/licenses/LICENSE,sha256=ic-27cMJc1kWoMEYncz3Ya3Ur2Bi3bNLWib2DT763-o,1067
|
641
|
+
pyg_nightly-2.7.0.dev20250504.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
642
|
+
pyg_nightly-2.7.0.dev20250504.dist-info/METADATA,sha256=xhjWav-LGW_50rzAl-sv3_1PoXWiwfWSOt72KhW_8nI,62979
|
643
|
+
pyg_nightly-2.7.0.dev20250504.dist-info/RECORD,,
|
torch_geometric/__init__.py
CHANGED
@@ -31,7 +31,7 @@ from .lazy_loader import LazyLoader
|
|
31
31
|
contrib = LazyLoader('contrib', globals(), 'torch_geometric.contrib')
|
32
32
|
graphgym = LazyLoader('graphgym', globals(), 'torch_geometric.graphgym')
|
33
33
|
|
34
|
-
__version__ = '2.7.0.
|
34
|
+
__version__ = '2.7.0.dev20250504'
|
35
35
|
|
36
36
|
__all__ = [
|
37
37
|
'Index',
|
@@ -81,6 +81,7 @@ from .git_mol_dataset import GitMolDataset
|
|
81
81
|
from .molecule_gpt_dataset import MoleculeGPTDataset
|
82
82
|
from .instruct_mol_dataset import InstructMolDataset
|
83
83
|
from .tag_dataset import TAGDataset
|
84
|
+
from .city import CityNetwork
|
84
85
|
|
85
86
|
from .dbp15k import DBP15K
|
86
87
|
from .aminer import AMiner
|
@@ -199,6 +200,7 @@ homo_datasets = [
|
|
199
200
|
'MoleculeGPTDataset',
|
200
201
|
'InstructMolDataset',
|
201
202
|
'TAGDataset',
|
203
|
+
'CityNetwork',
|
202
204
|
]
|
203
205
|
|
204
206
|
hetero_datasets = [
|
@@ -0,0 +1,156 @@
|
|
1
|
+
import os.path as osp
|
2
|
+
from typing import Callable, Optional
|
3
|
+
|
4
|
+
from torch_geometric.data import (
|
5
|
+
Data,
|
6
|
+
InMemoryDataset,
|
7
|
+
download_url,
|
8
|
+
extract_tar,
|
9
|
+
)
|
10
|
+
from torch_geometric.io import fs
|
11
|
+
|
12
|
+
|
13
|
+
class CityNetwork(InMemoryDataset):
|
14
|
+
r"""The City-Networks are introduced in
|
15
|
+
`"Towards Quantifying Long-Range Interactions in Graph Machine Learning:
|
16
|
+
a Large Graph Dataset and a Measurement"
|
17
|
+
<https://arxiv.org/abs/2503.09008>`_ paper.
|
18
|
+
The dataset contains four city networks: `paris`, `shanghai`, `la`,
|
19
|
+
and 'london', where nodes represent junctions and edges represent
|
20
|
+
directed road segments. The task is to predict each node's eccentricity
|
21
|
+
score, which is approximated based on its 16-hop neighborhood. The score
|
22
|
+
indicates how accessible one node is in the network, and is mapped to
|
23
|
+
10 quantiles for transductive classification. See the original
|
24
|
+
`source code <https://github.com/LeonResearch/City-Networks>`_ for more
|
25
|
+
details on the individual networks.
|
26
|
+
|
27
|
+
Args:
|
28
|
+
root (str): Root directory where the dataset should be saved.
|
29
|
+
name (str): The name of the dataset (``"paris"``, ``"shanghai"``,
|
30
|
+
``"la"``, ``"london"``).
|
31
|
+
augmented (bool, optional): Whether to use the augmented node features
|
32
|
+
from edge features.(default: :obj:`True`)
|
33
|
+
transform (callable, optional): A function/transform that takes in an
|
34
|
+
:class:`~torch_geometric.data.Data` object and returns a
|
35
|
+
transformed version. The data object will be transformed before
|
36
|
+
every access. (default: :obj:`None`)
|
37
|
+
pre_transform (callable, optional): A function/transform that takes in
|
38
|
+
an :class:`~torch_geometric.data.Data` object and returns a
|
39
|
+
transformed version. The data object will be transformed before
|
40
|
+
being saved to disk. (default: :obj:`None`)
|
41
|
+
force_reload (bool, optional): Whether to re-process the dataset.
|
42
|
+
(default: :obj:`False`)
|
43
|
+
|
44
|
+
**STATS:**
|
45
|
+
|
46
|
+
.. list-table::
|
47
|
+
:widths: 10 10 10 10 10
|
48
|
+
:header-rows: 1
|
49
|
+
|
50
|
+
* - Name
|
51
|
+
- #nodes
|
52
|
+
- #edges
|
53
|
+
- #features
|
54
|
+
- #classes
|
55
|
+
* - paris
|
56
|
+
- 114,127
|
57
|
+
- 182,511
|
58
|
+
- 37
|
59
|
+
- 10
|
60
|
+
* - shanghai
|
61
|
+
- 183,917
|
62
|
+
- 262,092
|
63
|
+
- 37
|
64
|
+
- 10
|
65
|
+
* - la
|
66
|
+
- 240,587
|
67
|
+
- 341,523
|
68
|
+
- 37
|
69
|
+
- 10
|
70
|
+
* - london
|
71
|
+
- 568,795
|
72
|
+
- 756,502
|
73
|
+
- 37
|
74
|
+
- 10
|
75
|
+
"""
|
76
|
+
url = "https://github.com/LeonResearch/City-Networks/raw/refs/heads/main/data/" # noqa: E501
|
77
|
+
|
78
|
+
def __init__(
|
79
|
+
self,
|
80
|
+
root: str,
|
81
|
+
name: str,
|
82
|
+
augmented: bool = True,
|
83
|
+
transform: Optional[Callable] = None,
|
84
|
+
pre_transform: Optional[Callable] = None,
|
85
|
+
force_reload: bool = False,
|
86
|
+
delete_raw: bool = False,
|
87
|
+
) -> None:
|
88
|
+
self.name = name.lower()
|
89
|
+
assert self.name in ["paris", "shanghai", "la", "london"]
|
90
|
+
self.augmented = augmented
|
91
|
+
self.delete_raw = delete_raw
|
92
|
+
super().__init__(
|
93
|
+
root,
|
94
|
+
transform,
|
95
|
+
pre_transform,
|
96
|
+
force_reload=force_reload,
|
97
|
+
)
|
98
|
+
self.load(self.processed_paths[0])
|
99
|
+
|
100
|
+
@property
|
101
|
+
def raw_dir(self) -> str:
|
102
|
+
return osp.join(self.root, self.name, "raw")
|
103
|
+
|
104
|
+
@property
|
105
|
+
def processed_dir(self) -> str:
|
106
|
+
return osp.join(self.root, self.name, "processed")
|
107
|
+
|
108
|
+
@property
|
109
|
+
def raw_file_names(self) -> str:
|
110
|
+
return f"{self.name}.json"
|
111
|
+
|
112
|
+
@property
|
113
|
+
def processed_file_names(self) -> str:
|
114
|
+
return "data.pt"
|
115
|
+
|
116
|
+
def download(self) -> None:
|
117
|
+
self.download_path = download_url(
|
118
|
+
self.url + f"{self.name}.tar.gz",
|
119
|
+
self.raw_dir,
|
120
|
+
)
|
121
|
+
|
122
|
+
def process(self) -> None:
|
123
|
+
extract_tar(self.download_path, self.raw_dir)
|
124
|
+
data_path = osp.join(self.raw_dir, self.name)
|
125
|
+
node_feat = fs.torch_load(
|
126
|
+
osp.join(
|
127
|
+
data_path,
|
128
|
+
f"node_features{'_augmented' if self.augmented else ''}.pt",
|
129
|
+
))
|
130
|
+
edge_index = fs.torch_load(osp.join(data_path, "edge_indices.pt"))
|
131
|
+
label = fs.torch_load(
|
132
|
+
osp.join(data_path, "10-chunk_16-hop_node_labels.pt"))
|
133
|
+
train_mask = fs.torch_load(osp.join(data_path, "train_mask.pt"))
|
134
|
+
val_mask = fs.torch_load(osp.join(data_path, "valid_mask.pt"))
|
135
|
+
test_mask = fs.torch_load(osp.join(data_path, "test_mask.pt"))
|
136
|
+
data = Data(
|
137
|
+
x=node_feat,
|
138
|
+
edge_index=edge_index,
|
139
|
+
y=label,
|
140
|
+
train_mask=train_mask,
|
141
|
+
val_mask=val_mask,
|
142
|
+
test_mask=test_mask,
|
143
|
+
)
|
144
|
+
if self.pre_transform is not None:
|
145
|
+
data = self.pre_transform(data)
|
146
|
+
|
147
|
+
self.save([data], self.processed_paths[0])
|
148
|
+
|
149
|
+
if self.delete_raw:
|
150
|
+
fs.rm(data_path)
|
151
|
+
|
152
|
+
def __repr__(self) -> str:
|
153
|
+
return (f"{self.__class__.__name__}("
|
154
|
+
f"root='{self.root}', "
|
155
|
+
f"name='{self.name}', "
|
156
|
+
f"augmented={self.augmented})")
|
@@ -279,6 +279,7 @@ class NeighborSampler(BaseSampler):
|
|
279
279
|
self.subgraph_type = SubgraphType(subgraph_type)
|
280
280
|
self.disjoint = disjoint
|
281
281
|
self.temporal_strategy = temporal_strategy
|
282
|
+
self.keep_orig_edges = False
|
282
283
|
|
283
284
|
@property
|
284
285
|
def num_neighbors(self) -> NumNeighbors:
|
@@ -321,7 +322,7 @@ class NeighborSampler(BaseSampler):
|
|
321
322
|
) -> Union[SamplerOutput, HeteroSamplerOutput]:
|
322
323
|
out = node_sample(inputs, self._sample)
|
323
324
|
if self.subgraph_type == SubgraphType.bidirectional:
|
324
|
-
out = out.to_bidirectional()
|
325
|
+
out = out.to_bidirectional(keep_orig_edges=self.keep_orig_edges)
|
325
326
|
return out
|
326
327
|
|
327
328
|
# Edge-based sampling #####################################################
|
@@ -334,7 +335,7 @@ class NeighborSampler(BaseSampler):
|
|
334
335
|
out = edge_sample(inputs, self._sample, self.num_nodes, self.disjoint,
|
335
336
|
self.node_time, neg_sampling)
|
336
337
|
if self.subgraph_type == SubgraphType.bidirectional:
|
337
|
-
out = out.to_bidirectional()
|
338
|
+
out = out.to_bidirectional(keep_orig_edges=self.keep_orig_edges)
|
338
339
|
return out
|
339
340
|
|
340
341
|
# Other Utilities #########################################################
|
File without changes
|
{pyg_nightly-2.7.0.dev20250502.dist-info → pyg_nightly-2.7.0.dev20250504.dist-info}/licenses/LICENSE
RENAMED
File without changes
|