Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
7d87dcec
"docs/vscode:/vscode.git/clone" did not exist on "b00a564dac2c6d430780159ca21982cdff31b2a9"
Unverified
Commit
7d87dcec
authored
Oct 11, 2023
by
Rhett Ying
Committed by
GitHub
Oct 11, 2023
Browse files
[GraphBolt][Doc] update impl (#6418)
parent
c1d117a6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
25 deletions
+41
-25
docs/source/api/python/dgl.graphbolt.rst
docs/source/api/python/dgl.graphbolt.rst
+0
-2
python/dgl/graphbolt/impl/basic_feature_store.py
python/dgl/graphbolt/impl/basic_feature_store.py
+1
-1
python/dgl/graphbolt/impl/csc_sampling_graph.py
python/dgl/graphbolt/impl/csc_sampling_graph.py
+12
-1
python/dgl/graphbolt/impl/neighbor_sampler.py
python/dgl/graphbolt/impl/neighbor_sampler.py
+7
-2
python/dgl/graphbolt/impl/ondisk_dataset.py
python/dgl/graphbolt/impl/ondisk_dataset.py
+9
-11
python/dgl/graphbolt/impl/sampled_subgraph_impl.py
python/dgl/graphbolt/impl/sampled_subgraph_impl.py
+3
-1
python/dgl/graphbolt/impl/torch_based_feature_store.py
python/dgl/graphbolt/impl/torch_based_feature_store.py
+2
-2
python/dgl/graphbolt/impl/uniform_negative_sampler.py
python/dgl/graphbolt/impl/uniform_negative_sampler.py
+7
-5
No files found.
docs/source/api/python/dgl.graphbolt.rst
View file @
7d87dcec
...
...
@@ -56,8 +56,6 @@ Standard Implementations
OnDiskDataset
BuiltinDataset
OnDiskTask
OnDiskMetaData
CSCSamplingGraph
UniformNegativeSampler
NeighborSampler
...
...
python/dgl/graphbolt/impl/basic_feature_store.py
View file @
7d87dcec
...
...
@@ -10,7 +10,7 @@ __all__ = ["BasicFeatureStore"]
class
BasicFeatureStore
(
FeatureStore
):
r
"""
B
asic feature store."""
r
"""
A b
asic feature store
to manage multiple features for access
."""
def
__init__
(
self
,
features
:
Dict
[
Tuple
[
str
,
str
,
str
],
Feature
]):
r
"""Initiate a basic feature store.
...
...
python/dgl/graphbolt/impl/csc_sampling_graph.py
View file @
7d87dcec
...
...
@@ -16,6 +16,17 @@ from ..sampling_graph import SamplingGraph
from
.sampled_subgraph_impl
import
SampledSubgraphImpl
__all__
=
[
"GraphMetadata"
,
"CSCSamplingGraph"
,
"from_csc"
,
"load_from_shared_memory"
,
"load_csc_sampling_graph"
,
"save_csc_sampling_graph"
,
"from_dglgraph"
,
]
class
GraphMetadata
:
r
"""Class for metadata of csc sampling graph."""
...
...
@@ -76,7 +87,7 @@ class GraphMetadata:
class
CSCSamplingGraph
(
SamplingGraph
):
r
"""
Class for CSC
sampling graph."""
r
"""
A
sampling graph
in CSC format
."""
def
__repr__
(
self
):
return
_csc_sampling_graph_str
(
self
)
...
...
python/dgl/graphbolt/impl/neighbor_sampler.py
View file @
7d87dcec
...
...
@@ -8,9 +8,13 @@ from ..utils import unique_and_compact_node_pairs
from
.sampled_subgraph_impl
import
SampledSubgraphImpl
__all__
=
[
"NeighborSampler"
,
"LayerNeighborSampler"
]
@
functional_datapipe
(
"sample_neighbor"
)
class
NeighborSampler
(
SubgraphSampler
):
"""
"""Sample neighbor edges from a graph and return a subgraph.
Neighbor sampler is responsible for sampling a subgraph from given data. It
returns an induced subgraph along with compacted information. In the
context of a node classification task, the neighbor sampler directly
...
...
@@ -121,7 +125,8 @@ class NeighborSampler(SubgraphSampler):
@
functional_datapipe
(
"sample_layer_neighbor"
)
class
LayerNeighborSampler
(
NeighborSampler
):
"""
"""Sample layer neighbor edges from a graph and return a subgraph.
Sampler that builds computational dependency of node representations via
labor sampling for multilayer GNN from the NeurIPS 2023 paper
`Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs
...
...
python/dgl/graphbolt/impl/ondisk_dataset.py
View file @
7d87dcec
...
...
@@ -279,13 +279,13 @@ class OnDiskTask:
class
OnDiskDataset
(
Dataset
):
"""An on-disk dataset.
"""An on-disk dataset which reads graph topology, feature data and
Train/Validation/Test set from disk.
An on-disk dataset is a dataset which reads graph topology, feature data
and TVT set from disk. Due to limited resources, the data which are too
large to fit into RAM will remain on disk while others reside in RAM once
``OnDiskDataset`` is initialized. This behavior could be controled by user
via ``in_memory`` field in YAML file.
Due to limited resources, the data which are too large to fit into RAM will
remain on disk while others reside in RAM once ``OnDiskDataset`` is
initialized. This behavior could be controled by user via ``in_memory``
field in YAML file.
A full example of YAML file is as follows:
...
...
@@ -477,12 +477,10 @@ class OnDiskDataset(Dataset):
class
BuiltinDataset
(
OnDiskDataset
):
"""GraphBolt builtin on-disk dataset.
"""A utility class to download built-in dataset from AWS S3 and load it as
``OnDiskDataset``.
This class is used to help download datasets from DGL S3 storage and load
them as ``OnDiskDataset``.
Available builtin datasets include:
Available built-in datasets include:
**ogbn-mag**
The ogbn-mag dataset is a heterogeneous network composed of a subset of
...
...
python/dgl/graphbolt/impl/sampled_subgraph_impl.py
View file @
7d87dcec
...
...
@@ -8,10 +8,12 @@ import torch
from
..base
import
etype_str_to_tuple
from
..sampled_subgraph
import
SampledSubgraph
__all__
=
[
"SampledSubgraphImpl"
]
@
dataclass
class
SampledSubgraphImpl
(
SampledSubgraph
):
r
"""
Class for s
ampled subgraph
specific for
CSCSamplingGraph.
r
"""
S
ampled subgraph
of
CSCSamplingGraph.
Examples
--------
...
...
python/dgl/graphbolt/impl/torch_based_feature_store.py
View file @
7d87dcec
...
...
@@ -12,7 +12,7 @@ __all__ = ["TorchBasedFeature", "TorchBasedFeatureStore"]
class
TorchBasedFeature
(
Feature
):
r
"""
T
orch based feature."""
r
"""
A wrapper of pyt
orch based feature."""
def
__init__
(
self
,
torch_feature
:
torch
.
Tensor
):
"""Initialize a torch based feature store by a torch feature.
...
...
@@ -130,7 +130,7 @@ class TorchBasedFeature(Feature):
class
TorchBasedFeatureStore
(
BasicFeatureStore
):
r
"""
T
orch based feature
store
."""
r
"""
A store to manage multiple pyt
orch based feature
for access
."""
def
__init__
(
self
,
feat_data
:
List
[
OnDiskFeatureData
]):
r
"""Load feature stores from disk.
...
...
python/dgl/graphbolt/impl/uniform_negative_sampler.py
View file @
7d87dcec
...
...
@@ -4,14 +4,16 @@ from torch.utils.data import functional_datapipe
from
..negative_sampler
import
NegativeSampler
__all__
=
[
"UniformNegativeSampler"
]
@
functional_datapipe
(
"sample_uniform_negative"
)
class
UniformNegativeSampler
(
NegativeSampler
):
"""
Negative samplers randomly select negative destination nodes for each
source node based on a uniform distribution. It's important to note that
the term 'negative' refers to false negatives,
indicating that the sampled
pairs are not ensured to be absent in the graph.
"""
Sample negative destination nodes for each source node based on a uniform
distribution.
It's important to note that
the term 'negative' refers to false negatives,
indicating that the sampled
pairs are not ensured to be absent in the graph.
For each edge ``(u, v)``, it is supposed to generate `negative_ratio` pairs
of negative edges ``(u, v')``, where ``v'`` is chosen uniformly from all
the nodes in the graph.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment