Are there Node2Vec, FastRP versions that considers node and edge attributes

From the documentation for Node2Vec and FastRP, I gather that they do not factor in node attributes or edge attributes (or just edge weights).

Is there a version somewhere which can factor these in?
Just looking at something similar to what Neo4j offers for FastRP at the moment:

Where there is some support for node attributes (see featureProperties), and edge weights (see relationshipWeightProperty)

Otherwise, any advice/tips on how to get started modifying the algorithms to factor them in?

Thank you!

We don’t currently have the feature or relationship weights implemented in the FastRP implementation currently. FastRP would be the easier one to incorporate this information between Node2Vec and FastRP.

For edge weights, you could multiply by e.weight when summing the source vectors here.
It would look something like this:

SELECT s FROM verts:s -(e_type:e)- :t
		ACCUM
			t.@embedding_arr += e.weight*s.@embedding_arr
		POST-ACCUM
            ...

For features, the modifications would be more involved, but I would start to look at where the embedding vectors are randomly initialized here: gsql-graph-algorithms/tg_fastRP.gsql at d38a2ffcf879ea843dcda1ba918b4db87b5f182b · tigergraph/gsql-graph-algorithms · GitHub.

Depending upon the use case of your embeddings, you may also want to consider Graph Neural Networks, which you can now easily train with the preview version of the ML Workbench: TigerGraph | Machine Learning Workbench.

Let me know if you have any other questions!

1 Like