Skip to content

Remove node_features, edge_features, graph_features methods#639

Open
calebjubal wants to merge 1 commit intoJuliaGraphs:masterfrom
calebjubal:bk/multiple-method-removal
Open

Remove node_features, edge_features, graph_features methods#639
calebjubal wants to merge 1 commit intoJuliaGraphs:masterfrom
calebjubal:bk/multiple-method-removal

Conversation

@calebjubal
Copy link

Summary

This PR removes the node_features, edge_features, and graph_features helper functions and updates all usages to direct property access.

Motivation

These convenience functions were problematic because:

  1. They only worked when there was a single feature array in ndata/edata/gdata

  2. They threw an error when multiple feature arrays existed, which was confusing

  3. Direct property access (g.ndata.x, g.edata.e, g.gdata.u) is more explicit and flexible

Changes

Removed:

  • node_features(g::GNNGraph) function definition
  • edge_features(g::GNNGraph) function definition
  • graph_features(g::GNNGraph) function definition
  • Exports from GNNGraphs module

Updated to use direct property access:

  • basic.jl - GNNLayer and GNNChain forward passes
  • conv.jl - GATConv, GATv2Conv, NNConv, CGConv, MEGNetConv, GMMConv, TransformerConv
  • pool.jl - GlobalPool, GlobalAttentionPool, Set2Set
  • pool.jl - GlobalPool, GlobalAttentionPool
    Test files updated accordingly

Migration

Users should replace:

# Before
x = node_features(g)
e = edge_features(g)
u = graph_features(g)

# After
x = g.ndata.x  # or whatever key was used
e = g.edata.e
u = g.gdata.u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant