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

Can weighted graphs be used inGraphSAGE? #462

Closed
ericbroda opened this issue Jul 28, 2019 · 7 comments
Closed

Can weighted graphs be used inGraphSAGE? #462

ericbroda opened this issue Jul 28, 2019 · 7 comments
Assignees
Labels
external An issue from someone outside the StellarGraph team sg-library

Comments

@ericbroda
Copy link

I have graphs that have weights that reflect the relative importance of some relationships compared to others. In other words, some links between nodes have lower weights (low importance) and others have higher weights (high importance).

This could be very useful for clustering and perhaps even node classification in situations where weights are available.

Is there a way to have GraphSAGE take this into account?

@adocherty
Copy link
Contributor

Hi Eric,

Currently edge weights are not supported in GraphSAGE. We are looking into possible ways to take edge weights into account. We will update this issue when we do.

Best regards,
Andrew

@adocherty adocherty added the ml label Jul 29, 2019
@colinwxl
Copy link

I am also interested in GraphSAGE on the weighted graph. In my opinion, it should consider both the sampling procedure and the link-prediction part.

@dproxy8
Copy link

dproxy8 commented Nov 28, 2019

This could be very useful for clustering and perhaps even node classification in situations where weights are available.

Could you specify more about ideas that weighted edges might be useful with node classification?

@timpitman timpitman added sg-library and removed ml labels Jan 13, 2020
@huonw huonw added the external An issue from someone outside the StellarGraph team label Mar 6, 2020
@huonw huonw self-assigned this Jun 9, 2020
huonw added a commit that referenced this issue Jun 12, 2020
This expands GraphSAGE (undirected and directed) to support weighted sampling,
where edges with higher weights are taken proportionally more often.

For example, suppose there's there's 4 edges from node A:

| source | target | weight |
|--------|--------|--------|
| A      | B      | 0      |
| A      | C      | 1      |
| A      | D      | 2      |
| A      | D      | 3      |

An unweighed walk starting at A will choose each of the edges with equal
propability and so end up on B, C or D in proportion 1:1:2 (edge counts). A
weighted walk will choose the edges proportional to the weights, so end up on
the vertices in proportion 0:1:5 (sum of edge weight). (Worth specifically
highlighting: a weighted walk will never chose the A-B edge because it has
weight 0.)

See: #462
@huonw
Copy link
Member

huonw commented Jun 12, 2020

We've now merged #1667, which adds support for edge weights in GraphSAGE sampling. Edge weights can be used for training a link prediction model too.

@patchy631
Copy link

We've now merged #1667, which adds support for edge weights in GraphSAGE sampling. Edge weights can be used for training a link prediction model too.

How can i use the edge weights as one of the parameters for link prediction?
Right now I'm trying to make some changes to sampled_link_generator.py, so that with every batch i also append the corresponding edge weight as a parameter. Plz help if a better way exists.

@adocherty
Copy link
Contributor

Hi,

I'm not clear as to what you are interested in doing with the edge weights. Could you tell us more about how you envisage the edge weight to be used as a parameter for link prediction?

@patchy631
Copy link

patchy631 commented Jul 4, 2021

Hi @adocherty
I'm working with a road network graph. Each node in my stellar graph is a single digital road element, it's neighbouring nodes would be the roads directly connected to it in reality. So on the edge i have number of vehicles going from a road to it's neighbour connected via this edge. So for doing link prediction I need to inculcate this traffic data present on the edge as one of the parameter for downstream classification.

So link data is like: (node1_data)-----edge_data-----(node2_data)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external An issue from someone outside the StellarGraph team sg-library
Projects
None yet
Development

No branches or pull requests

7 participants