Hi,

I am new to Neo4j and I am trying to extract the adjacency matrix of my graph. I found this cypher query (https://github.com/michelcaradec/Graph-Theory#adjacency-matrix) to get the adjacency matrix but it return the matrix without the row names and column names. How is it possible to save the names too?

Here is the cypher query:

// Get all vertices.

MATCH (n)

WITH collect(n) AS Nodes

// For each vertices combination...

WITH [n IN Nodes |

[m IN Nodes |

// ...Check for edge existence.

CASE size((n)--(m))

WHEN 0 THEN 0

ELSE 1

END

]

] AS AdjacencyMatrix

// Unroll rows.

UNWIND AdjacencyMatrix AS AdjacencyRows

RETURN AdjacencyRows;