#NEWLINE# def __db_degree__( self , tx ) : #NEWLINE# #INDENT# node_ids = [ ] #NEWLINE# for ( i , node ) in enumerate ( self . nodes ( ) ) : #NEWLINE# #INDENT# remote_node = remote ( node ) #NEWLINE# if remote_node : #NEWLINE# #INDENT# node_ids . append ( remote_node . _id ) #NEWLINE# #UNINDENT# #UNINDENT# statement = 'OPTIONAL MATCH (a)-[r]-() WHERE id(a) IN {x} RETURN count(DISTINCT r)' #NEWLINE# parameters = { #NEWLINE# #INDENT# 'x' : node_ids , #NEWLINE# #UNINDENT# } #NEWLINE# return tx . evaluate ( statement , parameters )