pytorch_geometric icon indicating copy to clipboard operation
pytorch_geometric copied to clipboard

GraphVAE for molecular generation

Open xiaolinpan opened this issue 4 years ago • 11 comments

I am a novice for graph generation. I notice the vae in PyG only can generate Adjacency matrix. Could you help me implememt the graphvae for molelualr generation? How to generate the atom type and bond type? thank you very much! https://arxiv.org/pdf/1802.03480.pdf

xiaolinpan avatar Jun 03 '20 01:06 xiaolinpan

The GraphVAE is somewhat difficult to implement since you can only utilize PyG for the Encoder part. The Decoder can be modeled by three different MLPs that map to [batch_size, num_nodes, num_nodes], [batch_size, num_nodes, num_nodes, num_bond_types], and [batch_size, num_nodes, num_atom_types] outputs. In addition, you need to implement the graph matching algorithm from Section 3.4 to train the model.

rusty1s avatar Jun 03 '20 06:06 rusty1s

thanks for your suggestions!

xiaolinpan avatar Jun 04 '20 06:06 xiaolinpan

Hi guys,

I am trying to figure out how to construct a molecule graph with bond information, but I am confused about how the decoder is modeled by three different MLPs. Would you guys mind explaining it a bit more?

Many many thanks

Yaoyx avatar Sep 18 '20 04:09 Yaoyx

As far as I know, the decoders of GraphVAE are just plain MLPs that map a low-dimensional vector z to (num_nodes, num_node_features), (num_nodes, num_nodes), and (num_nodes, num_nodes, num_edge_features), respectively.

rusty1s avatar Sep 21 '20 06:09 rusty1s

Thank you so much. I will try it out.

Yaoyx avatar Sep 23 '20 21:09 Yaoyx

As far as I know, the decoders of GraphVAE are just plain MLPs that map a low-dimensional vector z to (num_nodes, num_node_features), (num_nodes, num_nodes), and (num_nodes, num_nodes, num_edge_features), respectively.

I am trying to use PyG to generate new molecules, this is the paper i am trying to implement (https://arxiv.org/pdf/1908.08612.pdf) paper, can you help me how to get the nodes to build the graph.

leosv123 avatar Jun 03 '21 07:06 leosv123

Is there some open-source version of it available somewhere? Other-wise, it might be good to tell me which step you are currently implementing and what you have tried so far.

rusty1s avatar Jun 04 '21 07:06 rusty1s

How can I map Z of shape (# nodes, 256) into (# nodes, # nodes, # edge features)?

shrimonmuke0202 avatar Aug 09 '22 16:08 shrimonmuke0202

You can do:

z_src = z.view(1, num_nodes, num_features).repeat(num_nodes, 1, 1)
z_dst = z.view(num_nodes, 1, num_features).repeat(1, num_nodes, 1)

MLP(torch.cat([z_src, z_dst], dim=-1))

rusty1s avatar Aug 10 '22 04:08 rusty1s

Thanks for your reply, I came to know that molecular graph generation has three state-of-the-art models GraphVAE, GraphRNN, and Junction Tree Variational Autoencoders for Molecular graph generation. Which model should I use for molecular graph generation?

shrimonmuke0202 avatar Aug 10 '22 11:08 shrimonmuke0202

I am not an expert on graph generation, but I think that in the molecular graph setting, the junction tree representation is the most promising.

rusty1s avatar Aug 11 '22 09:08 rusty1s