Rename all nodes in the network from x to prefix_x.  If no prefix
        is given, use the name of the graph as the prefix.
        
        The purpose of this method is to make node names unique so that
        composing two graphs is well-defined.
353047
def addNodeLabelPrefix(self, prefix=None, copy=False):
        '''
        
        '''
        nxgraph = Topology.__relabel_graph(self.__nxgraph, prefix)
        if copy:
            newtopo = copy.deepcopy(self)
            newtopo.nxgraph = nxgraph
            return newtopo
        else:
            # looks like it was done in place
            self.__nxgraph = nxgraph
22936
def followingPrefix(prefix):
        """"""
        prefixBytes = array('B', prefix)

        changeIndex = len(prefixBytes) - 1
        while (changeIndex >= 0 and prefixBytes[changeIndex] == 0xff ):
            changeIndex = changeIndex - 1;
        if(changeIndex < 0):
            return None
        newBytes = array('B', prefix[0:changeIndex + 1])
        newBytes[changeIndex] = newBytes[changeIndex] + 1
        return newBytes.tostring()
719653
def substitute_namespace_into_graph(self, graph):
        
        for key, value in self.namespace.items():
            try:
                nodes = graph.vs.select(name=key)
                for node in nodes:
                    for k, v in value.items():
                        node[k] = v
            except:
                pass
            try:
                nodes = graph.es.select(name=key)
                for node in nodes:
                    for k, v in value.items():
                        node[k] = v
            except:
                pass
        return graph
114723
def merge_graphs(main_graph, addition_graph):
    

    node_mapping = {}
    edge_mapping = {}

    for node in addition_graph.get_all_node_objects():
        node_id = node['id']
        new_id = main_graph.new_node()
        node_mapping[node_id] = new_id

    for edge in addition_graph.get_all_edge_objects():
        edge_id = edge['id']
        old_vertex_a_id, old_vertex_b_id = edge['vertices']
        new_vertex_a_id = node_mapping[old_vertex_a_id]
        new_vertex_b_id = node_mapping[old_vertex_b_id]
        new_edge_id = main_graph.new_edge(new_vertex_a_id, new_vertex_b_id)
        edge_mapping[edge_id] = new_edge_id

    return node_mapping, edge_mapping
821445
def set_prefix(self, prefix):
        
        warnings.warn("set_prefix() is deprecated; use the prefix property",
                      DeprecationWarning, stacklevel=2)
        self.prefix = prefix
388801
def configure_alias(graph, ns, mappings):
    
    convention = AliasConvention(graph)
    convention.configure(ns, mappings)
960064
def refitMappings(self):
        
        for n in self.branch:
            n.nsprefixes = {}
        n = self.node
        for u, p in self.prefixes.items():
            n.addPrefix(p, u)
950896
def add_node(self, node_id, name, labels):
        
        node = self.graph_db.get_or_create_indexed_node('Node', 'node_id', node_id, {'node_id': node_id, 'name': name})
        try:
            node.add_labels(*labels)
        except NotImplementedError:
            pass
488257
def _reinsert_root_tag_prefix(v):
    
    if hasattr(v, 'original_prefix'):
        original_prefix = v.original_prefix
        del v.original_prefix
        v.tag = ''.join(('{', v.nsmap[original_prefix], '}VOEvent'))
    return
98367
def add_node(self, node_name):
        
        graph = self.graph
        if node_name in graph:
            raise KeyError('node %s already exists' % node_name)
        graph[node_name] = set()
1308509
def copy_from(self, g):
        
        renamed = {}
        for k, v in g.node.items():
            ok = k
            if k in self.place:
                n = 0
                while k in self.place:
                    k = ok + (n,) if isinstance(ok, tuple) else (ok, n)
                    n += 1
            renamed[ok] = k
            self.place[k] = v
        if type(g) is nx.MultiDiGraph:
            g = nx.DiGraph(g)
        elif type(g) is nx.MultiGraph:
            g = nx.Graph(g)
        if type(g) is nx.DiGraph:
            for u, v in g.edges:
                self.edge[renamed[u]][renamed[v]] = g.adj[u][v]
        else:
            assert type(g) is nx.Graph
            for u, v, d in g.edges.data():
                self.add_portal(renamed[u], renamed[v], symmetrical=True, **d)
        return self
926693
async def rename(self, name):
        """"""
        set_node_name = SetNodeName(pyvlx=self.pyvlx, node_id=self.node_id, name=name)
        await set_node_name.do_api_call()
        if not set_node_name.success:
            raise PyVLXException("Unable to rename node")
        self.name = name
307721
def to_networkx(self, labels=None, edge_labels=False):
        
        import networkx as nx
        graph = nx.DiGraph()
        for node in self._traverse_nodes():
            u = node.key
            graph.add_node(u)  # Minor redundancy
            # Set node properties
            graph.nodes[u]['value'] = node.value
            if labels is not None:
                label = ','.join([str(getattr(node, k)) for k in labels])
                graph.nodes[u]['label'] = label
            if node.left is not None:
                v = node.left.key
                graph.add_node(v)
                graph.add_edge(u, v)
                if edge_labels:
                    graph.edge[u][v]['label'] = 'L'
            if node.right is not None:
                v = node.right.key
                graph.add_node(v)
                graph.add_edge(u, v)
                if edge_labels:
                    graph.edge[u][v]['label'] = 'R'
        return graph
1232686
public static boolean isNodeTheSame(Node node1, Node node2)
  {
    if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
      return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
    else
      return (node1 == node2);
  }
1141813
def prefix(self, prefix):
        
        original_prefix = self._prefix
        self._prefix += prefix
        yield self
        self._prefix = original_prefix
1351414
def addRouter(self, name=None):
        '''
        
        '''
        if name is None:
            while True:
                name = 'r' + str(self.__rnum)
                self.__rnum += 1
                if name not in self.__nxgraph:
                    break
        self.__addNode(name, Router)
        return name
1113475
def rename_dimension(x, old_name, new_name):
  
  return reshape(x, x.shape.rename_dimension(old_name, new_name))