# How to transform an arbitrary graph into a fixed vector representation?

Actuality I work in computer vision, specifically on a problem known as "scene graph modeling." This problem aims to convert an image $$I$$ in a graph $$G=(V,E)$$ where the nodes $$V$$ represent the objects (and the features) in scene and the edges $$E$$ the relationships between objects. An interesting paper on this topic is Graph R-CNN for Scene Graph Generation (Note that unlike of only to detect the objects in an image, the scene graph aims to capture the contextual information of image). A graph is a mathematics structure rich in information, and it would be very interesting to integrate graphs in a machine learn approach. In order to achieve this task is necessary to transform a graph in a vector representation. Some works that intend solve this problem are the following:

• SEMI-SUPERVISED CLASSIFICATION WITH GRAPH CONVOLUTIONAL NETWORKS: The problem with this algorithm is that assumes a fix number of nodes. After training, this algorithm take a graph $$G=(V,E)$$ as input  (whit $$N$$ nodes, that is, $$|V|=N$$) and outputs a fixed vector representation.
• graph2vec: Learning Distributed Representations of Graphs: This algorithm is flexible due to permit build a vector representation from a graph $$G$$ without restrict the number of nodes. However, it needs to know the whole space graph. That is, given a set $$G=\{g_{1},g_{2},\dots,g_{i},\dots,g_{m}\}$$, where $$g_{i}$$ is the i-th graph, this algorithm builds a vectorial representation $$V=\{v_{1},v_{2},\dots,v_{i},\dots,v_{m}\}$$, where $$v_{i}$$ is the i-th vector associated with the graph $$g_{i}$$. This algorithm is originally proposed to text analysis, where the features in nodes are of low dimension, I do not know if it can work using high dimension features in nodes.

I would like to know if there is another simple algorithm that allows me to convert any graph into a fixed vector representation.

• There are dozens of such methods that you'll find by looking at papers that cite e.g., the first paper you mention which is well-known in the area. But I think you are not asking the right question. I mean, you could always output say a 2-element vector $(|V|,|E|)$, but it won't probably have enough information to be helpful in your ML task. So you need to think harder as to what properties of the graph you want to capture that would be helpful, and go from there. – Juho Aug 15 at 16:09
• Each node has a feature associated belonging to $R^d$ space, and each edge a weight associated. I would want to extract a global information that capture, features in nodes, weigh in edges and the relational structure. – Roger Figueroa Quintero Aug 16 at 1:13