Creating GraphModels in tensorflow.js

Is there any plan to enable the creation of a GraphModel using tensorflow.js?

This seems (?) to be a blocker in enabling tensorflow.js to implement GCNs.

I know you can import a GraphModel, but that’s not much use if you want your TensorFlow usage to be entirely within a browser environment, incl. constructing GraphModels in the browser.

Does this help? Talks about a Keras implementation for about 14 minutes in

I’m assuming you can then convert the model to tf.js?

Also Graph Convolutional Network in Tensorflow.js / Aman Tiwari / Observable

It’d be good to see someone using this to make a node or edge prediction.

I can kind of follow this but would need to copy/paste it into my app and play around to fully get it, but can see it follows the approach used in the Python-based video you posted above.

It’d possibly be simplest if the person who wrote GCNs for tensorflow could just port it to tensorflow.js :slight_smile:

In my scenario I have 61 node types, and 11 edge types, and both nodes + edges can have properties which are important in making node and edge predictions, e.g.

  • node prediction - given a source node + edge, what is the target node predicted?
  • edge prediction - given a source and target node, what is the edge predicted?

My training set is a bunch of graphs of varying sizes, and containing different subsets of the 61/11 nodes/edges respectively, and for training I need to train on multiple graphs, i.e. there isn’t just 1 big graph.

So in my “Simple GCN” implementation I decompose the, say, 20 graphs, all into a bunch of tripes (source, edge, target) and put it through a sequential model.

This seems to allow for pretty good node/edge predictions.

I can’t see how in the video or link you provided you would go about training on multiple graphs – I could treat them as 1 big graph where the ‘subgraphs’ weren’t connected to each other I guess.

I also worked out what I really need is a Relational GCN, where there are different node types, edge types, and each of the nodes and edges has its own features, and the graph is directional.

Zak Jost has posted about this, but I haven’t seen anyone come close to building one of these in Javascript.