Search code examples
neo4jpy2neo

py2neo - Functions like COUNT(),MIN(),MAX() in py2neo Api.(without using cypher.execute)


HI,
I am new to Py2neo API. I have good knowledge using cypher but my requirement is to run python API (instead of cypher.execute("****")), because of performing analytics operation on graph.

I want a way to find the no of nodes in the graph, which is equivalent to MATCH n RETURN COUNT(n).


Solution

  • The Graph object has a order attribute (http://py2neo.org/2.0/essentials.html#py2neo.Path.order)

    from py2neo import Graph
    
    graph = Graph()
    
    print(graph.order)