Comments (9)
I am not familiar enough with this problem, but like the way networkx follows Python's style so that users, if they are confused, have some "prior" suspect. For the "independent shallow" that networkx provides, does it raises issue with our current models, or does it work okay and we just need to warn the user about the potential problems?
And, the worst is to ask users to do deep copy and maintain the states themselves. Correct?
from dgl.
After an "independent shallow" copy, a graph and its duplicate will share representations. However, if we update the representations of either the graph or its duplicate with current API, they will not share representations any more.
# Assume that g.nodes[n]['x'] == 0 for every node n
h = g.copy()
h.register_message_func(lambda src, trg, _: None)
h.register_update_func(lambda node_reprs, edge_reprs: 1)
h.update_all()
Now, g.nodes[n]['x'] == 0
and h.nodes[n]['x'] == 1
for every node n
. To sync between g
and h
, we have to write
for n, d in g.nodes.items():
d['x'] = h.nodes[n]['x']
In this case sync is not tricky. However, sync between graphs may become a burden for user, e.g. line 153 - 156 and line 164 - 167 in line_graph/gnn.py. Syncing by iterating through all nodes is not very efficient either. So the question is can we help users to sync between graphs automatically?
I hope this makes more sense.
from dgl.
I played with networkx's copy
a little and understand what it is now:
For the time being, I'd suggest simply add a sync_state(g_src, g_tgt, name="all")
to make it easy for the user, and deal with performance issue later.
from dgl.
I would suggest the following (implemented by overriding networkx methods):
# Assume that isinstance(g, DGLGraph), g.nodes[0]['h'] == 12, g.edges[0, 1]['h'] == 12
g_c = g.copy(share=['h'])
g_c.nodes[0]['h'] = 13 # Now g.nodes[0]['h'] == 13
g_c = DGLGraph()
g_c.add_nodes_from(g.nodes, share=['x'])
g_c.nodes[0]['h'] = 13 # Now g.nodes[0]['h'] == 13
g_c = DGLGraph()
g_c.add_edges_from(g.edges, share=['x'])
g_c.edges[0, 1]['h'] = 13 # Now g.edges[0, 1]['h'] == 13
This interface is less flexible compared to sync_state
because states are always synced after copy
, add_nodes_from
and add_edges_from
. However, it provides us with more information about which attributes will be synced and thus may benefit optimization.
from dgl.
from dgl.
from dgl.
Does the example need to be runnable?
from dgl.
from dgl.
Current solution for state sharing is using FrameRef (PR #39 ). More examples are coming on this syntax.
from dgl.
Related Issues (20)
- [DistGB] enable `replace` in sample_neighbors() with GraphBolt
- [DistGB] enable `prob` in sample_neighbors() with GraphBolt HOT 3
- [DistGB] graphbolt sampling with negative sampler in `DistEdgeDataLoader` on homograph HOT 2
- [DistGB] `find_edges(eids)` support for GraphBolt partitions
- [DistGB] sample on GraphBolt partitions with various dtypes
- Missing var in Documentation HOT 3
- [Performance] The performance of dgl.DGLGraph.apply_edges has dropped in some test. HOT 1
- [MPS] Metal Performance Shaders (MPS) backend for GPU training acceleration(Mac)
- Deepwalk Network Adaptability HOT 1
- [GraphBolt] high memory consumption when building GPU version HOT 11
- Migrating CMake build from `FindCUDA` to `FindCUDAToolkit` HOT 3
- [GraphBolt] Tensor Constructor for TorchBasedFeatureStore HOT 2
- DGL dataloader returns batch size None HOT 3
- [GraphBolt] extend regression tests for pipelining optimization HOT 3
- [GraphBolt] Dataset dtypes HOT 12
- [DistGB] `IdMap` support `int64` ids only HOT 2
- How should I install a compatible DGL cuda enabled version in Colab for CUDA 12.2? HOT 3
- Unable to install version 2.0 from Google Colab HOT 5
- [GraphBolt] Compress type_per_edge array so that instead of COO, we use CSC. HOT 2
- [DistGB] remove `utils.toindex()` from DistDGL
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.