def prune_node(self, node, remove_backrefs=False):
        """
        remove node `node` from the network (including any edges that may
        have been pointing at `node`).
        """
        if not remove_backrefs:
            for fro, connections in self.edges.items():
                if node in self.edges[fro]:
                    raise ValueError("""Attempting to remove a node with
                                     backrefs. You may consider setting
                                     `remove_backrefs` to true.""")

        # OK. Otherwise, let's do our removal.

        self.nodes.remove(node)
        if node in self.edges:
            # Remove add edges from this node if we're pruning it.
            self.edges.pop(node)

        for fro, connections in self.edges.items():
            # Remove any links to this node (if they exist)
            if node in self.edges[fro]:
                # If we should remove backrefs:
                self.edges[fro].remove(node)
def prune_node ( self , node , remove_backrefs = False ) : if not remove_backrefs : for fro , connections in self . edges . items ( ) : if node in self . edges [ fro ] : raise ValueError ( """Attempting to remove a node with
                                     backrefs. You may consider setting
                                     `remove_backrefs` to true.""" ) self . nodes . remove ( node ) if node in self . edges : self . edges . pop ( node ) for fro , connections in self . edges . items ( ) : if node in self . edges [ fro ] : self . edges [ fro ] . remove ( node )
remove node `node` from the network (including any edges that may
        have been pointing at `node`).