Comments (5)
from dgl.
Well, my point is that if we do g.edges[0, 1]
, users may wonder whether we are accessing the edge with src 0 and dest 1 or accessing two edges with edge ids 0 and 1.
from dgl.
I think this is our job of educating users. We should tell user that g.edges
returns a view (same as networkx). The view object contains two convenient overloads:
__getitem__
to access data of the given edge(s).__call__
to access all the edge ids.
g.edges[0, 1]
is equivalent to g.edges.__getitem__((0, 1))
(in accordance with python). As a result, g.edges[0, 1]
accesses one edge (0, 1)
.
list
type is introduced in DGL to express multiple nodes/edges at once, which usually raises TypeError
in normal container overload. Hence, accessing two edges at once should be g.edges[[0, 1]]
.
The rules are:
tuple
type is reserved to represent edge with two endpoints. (for example, we should not allowg.edges[0, 1, 2]
. That will be really confusing.).list
andtensor
types are used to represent multiple node/edge ids.
from dgl.
Also, since __call__
is defined for g.edges
. g.edges()
will return the edge ids (in uv
or eid
). This also comes from the practice of networkx
.
from dgl.
Alright, I will mention it in the doc.
from dgl.
Related Issues (20)
- [Temporal] Performance comparison with PyTorch
- [GraphBolt][Regression] MultiGPU benchmark on papers100M HOT 1
- [io_uring] Disable liburing as it's not quite stable HOT 4
- [GraphBolt] TorchData Pytorch support HOT 4
- [GraphBolt][Bug] SEGV when preprocessing `OnDiskDataset` HOT 14
- [Bug] Hetero sampling on CPU HOT 3
- Multi-GPU training for DGL+ALIGNN HOT 2
- [GraphBolt][CUDA] GPUCachedFeature update bug when feature dimensions differ HOT 2
- [release] Build DGL package based on ubi7 to support lower glibc version
- [torchdata] cannot import name 'DILL_AVAILABLE' from 'torch.utils.data.datapipes.utils.common' HOT 2
- [GraphBolt][MultiGPU] Error occurs when running multiGPU example with `num-workers` > 0 HOT 9
- [GraphBolt] FeatureFetcher throws exception if `input_nodes` does not contain target feature HOT 2
- [GraphBolt] Remove workaround for `DILL_AVAILABLE` in torch 2.3.0 HOT 5
- preprocess_ondisk_dataset fails on absolute paths HOT 1
- [Examples]GATNE-T example uses gensim package, which in turn uses deprecated and removed API HOT 3
- [Misc] Aliases in `typing` are deprecated since py 3.9 HOT 1
- Question/possible bug with SIGNDiffusion transform HOT 1
- Build fails: error: duplicate symbol: libxsmm_verbosity HOT 1
- TypeError: self.chandle cannot be converted to a Python object for pickling HOT 2
- [Bug] [Example] Transformer example is dated and does not work with latest networkx HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgl.