Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNNGraph with multiple edge features not working #243

Closed
chrisn-pik opened this issue Dec 19, 2022 · 1 comment
Closed

GNNGraph with multiple edge features not working #243

chrisn-pik opened this issue Dec 19, 2022 · 1 comment

Comments

@chrisn-pik
Copy link

Using one feature per edge is possible, e.g.

s = [1,1,2,3]
t = [2,3,1,1]
w = [1.1, 0.1, 2.3, 0.5]
g = GNNGraph(s, t, w)

However, I cannot find a way to use multiple features per edge, e.g.

w2 = [w, w]
g2 = GNNGraph(s, t, w2)

w2 is only a toy example. Several datasets have edges with multiple features, so this would be an important feature for several applications.

@CarloLucibello
Copy link
Member

We distinguish edge weights, which are a single set of scalar numbers, from edge features. For instance here I create edge weights and two edge features array:

s = [1,1,2,3]
t = [2,3,1,1]
w = Float32[1.1, 0.1, 2.3, 0.5]
a = rand(Float32, 1, 4)     # edge features of dimension 1       
b = rand(Float32, 10, 4)  # edge features of dimension 10
g = GNNGraph(s, t, w, edata=(; a, b))

# access with
g.edata.a

# some other alternatives:
g = GNNGraph(s, t, edata=a)
# e is the default name when no one is provided
g.edata.e

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

No branches or pull requests

2 participants