#NEWLINE# def subtreeAt( self , vertexId ) : #NEWLINE# #INDENT# '\n        Compute the subtree starting from a particular vertex id \n        ' #NEWLINE# subtree = DictTree ( ) #NEWLINE# vertexIds = self . subtreeIds ( vertexId ) #NEWLINE# vertexIds = set ( vertexIds ) #NEWLINE# for vertexId in vertexIds : #NEWLINE# #INDENT# if ( vertexId in self . adjacencies . keys ( ) ) : #NEWLINE# #INDENT# subtree . __touchVertex ( vertexId ) #NEWLINE# subtree . adjacencies [ vertexId ] = self . adjacencies [ vertexId ] . copy ( ) #NEWLINE# #UNINDENT# #UNINDENT# deleteIdList = [ ] #NEWLINE# for vertex1 in subtree . adjacencies . keys ( ) : #NEWLINE# #INDENT# for vertex2 in subtree . adjacencies [ vertex1 ] . keys ( ) : #NEWLINE# #INDENT# if ( vertex2 not in vertexIds ) : #NEWLINE# #INDENT# deleteIdList . append ( ( vertex1 , vertex2 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for ( vertex1 , vertex2 ) in deleteIdList : #NEWLINE# #INDENT# del subtree . adjacencies [ vertex1 ] [ vertex2 ] #NEWLINE# #UNINDENT# return subtree