def _strip_list_attributes(graph_):
    """Converts lists attributes to strings for all nodes and edges in G."""
    for n_ in graph_.nodes(data=True):
        for k,v in n_[1].iteritems():
            if type(v) is list:
                graph_.node[n_[0]][k] = unicode(v)
    for e_ in graph_.edges(data=True):
        for k,v in e_[2].iteritems():
            if type(v) is list:
                graph_.edge[e_[0]][e_[1]][k] = unicode(v)

    return graph_
def _strip_list_attributes ( graph_ ) : for n_ in graph_ . nodes ( data = True ) : for k , v in n_ [ 1 ] . iteritems ( ) : if type ( v ) is list : graph_ . node [ n_ [ 0 ] ] [ k ] = unicode ( v ) for e_ in graph_ . edges ( data = True ) : for k , v in e_ [ 2 ] . iteritems ( ) : if type ( v ) is list : graph_ . edge [ e_ [ 0 ] ] [ e_ [ 1 ] ] [ k ] = unicode ( v ) return graph_
Converts lists attributes to strings for all nodes and edges in G.