from_networkx enhancement
See original GitHub issueFrom now on, we recommend using our discussion forum (https://github.com/rusty1s/pytorch_geometric/discussions) for proposing new features.
🚀 Feature
My proposal is to modify the from_networkx
method to incorporate the option of creating data.x on the fly from node features (and similarly from edge features)
Motivation
The current from_networkx method does not convert the nodes features into property x (that is, data.x
). I think enhancing this would be particularly useful for hand-crafted graph datasets that are saved and loaded using networkx methods.
Additional context
Some implementation details worth discussing:
- One idea is to leave numerical features as they are, and one-hot encode categorical ones. Is the one-hot encoding needed or should each feature contain at most one item? It may be worth the flexibility, we could for example one-hot encode the node feature values that are lists, and just convert to numbers the rest.
- Perhaps we should allow the user to define a dictionary of node features and possible values to allow coherent numericalization of many graphs if they form a “dataset” (not a Pytorch Geometric dataset, just a normal list of graphs)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
dgl.from_networkx — DGL 0.9.1post1 documentation
Create a graph from a NetworkX graph and return. Note. Creating a DGLGraph from a NetworkX graph is not fast especially for large...
Read more >StellarGraph.from_networkx(node_features=...) could ... - GitHub
Description In #1047, @ntrpnr has a heterogeneous graph with 5 node types (tenant user process session computer).
Read more >complete_to_chordal_graph — NetworkX 2.8.8 documentation
There are different approaches to calculate the chordal enhancement of a graph. The algorithm used here is called MCS-M and gives at least...
Read more >rustworkx for NetworkX users - Qiskit
This is an introductory guide for existing NetworkX users on how to use rustworkx, how it differs from NetworkX, and key differences to...
Read more >Python NetworkX for Graph Optimization Tutorial - DataCamp
... functionality may be removed from NetworkX or only available as an add-on package. ... it does unlock enhanced quality and control over...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we should ignore that for now, and extend functionality in later PRs if that’s okay for you.
One possible interface:
where attributes in
group_node_attrs
andgroup_edge_attrs
get grouped/merged/concatenated intox
andedge_attr
, respectively. WDYT?