0

I have an graph in (igraph-python)

n_vertices = 3
edges = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (3, 4)]
graph = ig.Graph(n_vertices, edges)

How to represent the graph by a tensor like how to reach the follow point

Data(edge_index, x, y, train_mask)
Ana_1960
  • 39
  • 1
  • 8
  • Does this answer your question? [Pytorch Geometric sparse adjacency matrix to edge index tensor](https://stackoverflow.com/questions/69091074/pytorch-geometric-sparse-adjacency-matrix-to-edge-index-tensor) – ndrwnaguib Oct 23 '22 at 07:14
  • I'm not sure if this 'to_scipy_sparse_matrix' also works on igraph, I saw it more in networkx – Ana_1960 Oct 23 '22 at 09:12
  • can you give an example for it on this graph? – Ana_1960 Oct 23 '22 at 10:00
  • 1
    You can get the sparse adjacency matrix using [get_adjacency_sparse](https://igraph.readthedocs.io/en/0.10.2/api/igraph.Graph.html#get_adjacency_sparse). – Vincent Traag Oct 23 '22 at 12:28
  • 1
    it worked, thnx you two still thinking out how and what to do for x – Ana_1960 Oct 23 '22 at 14:38

0 Answers0