Skip to content

Weighted Edge Message Passing #444

Closed Answered by MarcosZ
MarcosZ asked this question in Q&A
Discussion options

You must be logged in to vote

The solution here seems to be to add edge weights as an edge attribute and generate another message in a custom MessagePassing layer. It will look like this in your propagate() function, where e is an array the same dimensions as x, your node attributes, but has your edge weights per neighbor.

# Edge Message
msg_kwargs = self.get_kwargs(x, a, e, self.msg_signature, kwargs)
message_e = self.message(e, **msg_kwargs)

# Aggregate
agg_kwargs = self.get_kwargs(x, a, e, self.agg_signature, kwargs)
weights = self.aggregate(message_e, **agg_kwargs)

# Update
upd_kwargs = self.get_kwargs(x, a, e, self.upd_signature, kwargs)
output = self.update(embeddings, **upd_kwargs)

I then return both the embe…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MarcosZ
Comment options

Answer selected by MarcosZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant