#NEWLINE# def subgraph( self , nodes ) : #NEWLINE# #INDENT# '\n        Return the subgraph consisting of the given nodes and edges\n        between thses nodes.\n\n        Parameters\n        ----------\n        nodes : array_like(int, ndim=1)\n           Array of node indices.\n\n        Returns\n        -------\n        DiGraph\n            A DiGraph representing the subgraph.\n\n        ' #NEWLINE# adj_matrix = self . csgraph [ nodes , : ] [ : , nodes ] #NEWLINE# weighted = True #NEWLINE# if ( self . node_labels is not None ) : #NEWLINE# #INDENT# node_labels = self . node_labels [ nodes ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# node_labels = None #NEWLINE# #UNINDENT# return DiGraph ( adj_matrix , weighted = node_labels , node_labels = node_labels )