# Graph Classification with Specific Nodes

Hi everyone,

I’m doing some research for a project and the dataset I’m using happens to be graphs. DGL has been a great resource thus far and I currently have a neural network running that basically mimics this tutorial Training a GNN for Graph Classification — DGL 0.6.1 documentation.

I have a couple of questions thus far. The data set I am using may be unique when compared to other examples because every graph has exactly the same nodes but the connections/adjacency are different from graph to graph. As a simplified example, let’s say we have nodes x1, x2, and x3. In graph 1, x1 is directed towards x2 and x2 towards x3. In graph 2, both x1 and x3 are directed towards x2. The important thing is that x1, x2, and x3 are exactly the same node in every graph but they are connected differently. I am wondering how I should approach such a task and if the above tutorial is accounting for something like this because otherwise I can imagine that the data looks extremely repetitive to the neural network and it may be unable to actually learn much of anything?

My second question is regarding hidden layers. The graphs I am using have no features whatsoever. There is only the graph and the class it is in. With that being said, what do the hidden layers look like? The above tutorial does not explain and I’m really curious how the hidden layers are working in an example like mine where there are no features. Is a graph convolutional network the appropriate method to tackle this kind of problem?

Sorry for the lengthy questions and thank you!
Elias

Hi,

For the graph without feature, you can learn node embeddings for each nodes by the link prediction following this tutorial 5.3 Link Prediction — DGL 0.6.1 documentation. Or tried the deepwalk example in our repo.

For the first question, you can use a shared node feature for all the graph, and do the message passing on each graph. And accumulate the gradient through all the graph to update the features

Thank you for your response. I will see if I can make any progress. I appreciate your help!

Sorry I’m not quite sure what you mean by using a shared node feature for all the graph. Can you please explain?

``````node_feature = torch.zeros((num_nodes, hidden_dim))
for g in g_list:
g.ndata['h'] = node_feature # here all g share the same node data
``````