class_docstr: Neo4jStellarGraph class for graph machine learning on graphs stored in
  a Neo4j database.
  
  This class communicates with Neo4j via a :class:`py2neo.Graph` connected to the graph
  database of interest and contains functions to query the graph data necessary
  for machine learning.
  
  .. seealso:: `Examples using Neoj <https://stellargraph.readthedocs.io/en/stable/demos/connector/neo4j/index.html>`__.
  
  Args:
      graph_db (py2neo.Graph): a :class:`py2neo.Graph` connected to a Neo4j graph database.
      node_label (str, optional): Common label for all nodes in the graph, if such label exists.
          Providing this is useful if there are any indexes created on this label (e.g. on node IDs),
          as it will improve performance of queries.
      id_property (str, optional): Name of Neo4j property to use as ID.
      features_property (str, optional): Name of Neo4j property to use as features.
      is_directed (bool, optional): If True, the data represents a
          directed multigraph, otherwise an undirected multigraph.
class_docstr_tok: ["Neo4jStellarGraph","class","for","graph","machine","learning","on","graphs","stored","in","a","Neo4j","database",".","This","class","communicates","with","Neo4j","via","a",":","class",":","`","py2neo.Graph","`","connected","to","the","graph","database","of","interest","and","contains","functions","to","query","the","graph","data","necessary","for","machine","learning",".","..","seealso",":",":","`","Examples","using","Neoj","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/connector\/neo4j\/index.html",">","`","__",".","Args",":","graph_db","(","py2neo.Graph",")",":","a",":","class",":","`","py2neo.Graph","`","connected","to","a","Neo4j","graph","database",".","node_label","(","str",",","optional",")",":","Common","label","for","all","nodes","in","the","graph",",","if","such","label","exists",".","Providing","this","is","useful","if","there","are","any","indexes","created","on","this","label","(","e.g",".","on","node","IDs",")",",","as","it","will","improve","performance","of","queries",".","id_property","(","str",",","optional",")",":","Name","of","Neo4j","property","to","use","as","ID",".","features_property","(","str",",","optional",")",":","Name","of","Neo4j","property","to","use","as","features",".","is_directed","(","bool",",","optional",")",":","If","True",",","the","data","represents","a","directed","multigraph",",","otherwise","an","undirected","multigraph","."]
code: def __init__(
      self,
      graph_db,
      node_label=None,
      id_property=globalvar.NEO4J_ID_PROPERTY,
      features_property=globalvar.NEO4J_FEATURES_PROPERTY,
      is_directed=False,
  ):
      try:
          import py2neo
      except ModuleNotFoundError as e:
          raise ModuleNotFoundError(
              f"{e.msg}. StellarGraph can only connect to Neo4j using the 'py2neo' module; please install it",
              name=e.name,
              path=e.path,
          ) from None
  
      # check for node ID constraint
      warn_msg = "Queries may be slow to run and may experience unexpected behaviour if there are duplicate IDs. Please consider creating a uniqueness constraint on a label applied to all nodes in the graph."
      if node_label is None:
          warnings.warn(
              "node_label: No node label provided. " + warn_msg,
              RuntimeWarning,
              stacklevel=2,
          )
      else:
          constraint_query = """
                  CALL db.constraints
                  """
          constraint_regex = re.compile(
              rf"^CONSTRAINT ON \( \w+:{node_label} \) ASSERT \(\w+.{id_property}\) IS UNIQUE$"
          )
          constraint_exists = False
          for c in graph_db.run(constraint_query).data():
              if constraint_regex.match(c["description"]):
                  # found constraint on node IDs
                  constraint_exists = True
                  break
          if not constraint_exists:
              warnings.warn(
                  f"node_label: No uniqueness constraint found on IDs of nodes with label '{node_label}'. {warn_msg}",
                  RuntimeWarning,
                  stacklevel=2,
              )
  
      self.graph_db = graph_db
  
      def raw_and_cypher(raw):
          if raw is not None:
              return raw, py2neo.cypher_escape(raw)
          else:
              return None, None
  
      self.raw_node_label, self.cypher_node_label = raw_and_cypher(
          node_label
      )
      self._is_directed = is_directed
      self._node_feature_size = None
      self._nodes = None
  
      # names of properties to use when querying the database
      self.raw_id_property, self.cypher_id_property = raw_and_cypher(
          id_property
      )
      (
          self.raw_features_property,
          self.cypher_features_property,
      ) = raw_and_cypher(features_property)
  
      # FIXME: methods in this class currently only support homogeneous graphs with default node type
      self._node_type = globalvar.NODE_TYPE_DEFAULT
  
imports: import numpy
  import scipy.sparse
  import pandas
  import re
  import warnings
  from ...None import globalvar
  from ...core.experimental import experimental
  from ...core import convert
  from ...core.indexed_array import IndexedArray
  from ...core.graph import extract_element_features
  from ...core.validation import comma_sep
label_desc: Use image node_id 1 to create a new Neo4jStellarGraph object  with example: obj = Neo4jStellarGraph(graph_db, node_label, id_property, features_property, is_directed)