Hi,

I am new to Neo4j and I am trying to extract the adjacency matrix of my graph. I found this cypher query (GitHub - michelcaradec/Graph-Theory: A workshop about implementing graph theory with Neo4j) 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;