# Ticket #12318: trac_12318_removing_kwds.patch

File trac_12318_removing_kwds.patch, 7.6 KB (added by brunellus, 16 months ago)
• ## sage/geometry/polyhedra.py

```# HG changeset patch
# User Lukas Lansky <lansky@kam.mff.cuni.cz>
# Date 1326908722 0
# Parent  7e8784ab604a363654f47cfeaf0c3f5a1725d2c2
Trac 12318: removing **kwds from the Graph constructor

diff --git a/sage/geometry/polyhedra.py b/sage/geometry/polyhedra.py```
 a from sage.groups.perm_gps.permgroup import PermutationGroup G = Graph(dense=False) G = Graph(sparse=True) for edge in self.vertex_graph().edges(): i = edge[0] j = edge[1] # Finally, construct the graph Qinv = sum( v.column() * v.row() for v in v_list ).inverse() G = Graph(dense=True) G = Graph(sparse=False) for i in range(0,len(v_list)): for j in range(i+1,len(v_list)): v_i = v_list[i]
• ## sage/geometry/triangulation/point_configuration.py

`diff --git a/sage/geometry/triangulation/point_configuration.py b/sage/geometry/triangulation/point_configuration.py`
 a # construct the graph from sage.graphs.graph import Graph G = Graph(dense=True) G = Graph(sparse=False) for i in range(0,len(v_list)): for j in range(i+1,len(v_list)): v_i = v_list[i]
• ## sage/graphs/bipartite_graph.py

`diff --git a/sage/graphs/bipartite_graph.py b/sage/graphs/bipartite_graph.py`
 a sage: partition = [range(5), range(5,10)] sage: B = BipartiteGraph(P, partition, check=False) """ check = True if 'check' in kwds: check = kwds['check'] del kwds['check'] if len(args) == 0: Graph.__init__(self, **kwds) self.left = set() if set(arg1.vertices()) != verts: arg1 = arg1.subgraph(list(verts)) Graph.__init__(self, arg1, *(args[1:]), **kwds) if "check" not in kwds or kwds["check"]: if check: while len(left) > 0: a = left.pop(0) if len(set(arg1.neighbors(a)) & set(left)) != 0:
• ## sage/graphs/digraph.py

`diff --git a/sage/graphs/digraph.py b/sage/graphs/digraph.py`
 a Whether to allow any object as a vertex (slower), or only the integers 0, ..., n-1, where n is the number of vertices. -  ``convert_empty_dict_labels_to_None`` - see the ``format`` argument documentation. EXAMPLES: def __init__(self, data=None, pos=None, loops=None, format=None, boundary=[], weighted=None, implementation='c_graph', sparse=True, vertex_labels=True, **kwds): sparse=True, vertex_labels=True, name=None, multiedges=None, convert_empty_dict_labels_to_None=None): """ TESTS:: """ msg = '' GenericGraph.__init__(self) multiedges = kwds.get('multiedges', None) from sage.structure.element import is_Matrix from sage.misc.misc import uniq if format is None and isinstance(data, str): # At this point, format has been set. # adjust for empty dicts instead of None in NetworkX default edge labels kwds.setdefault('convert_empty_dict_labels_to_None', (format == 'NX')) if convert_empty_dict_labels_to_None is None: convert_empty_dict_labels_to_None = (format == 'NX') verts = None if format == 'dig6': if f(uu,vv): self.add_edge(uu,vv) elif format == 'dict_of_dicts': if kwds.get('convert_empty_dict_labels_to_None', False): if convert_empty_dict_labels_to_None: for u in data: for v in data[u]: if multiedges: assert format == 'int' self._pos = pos self._boundary = boundary name = kwds.get('name', None) if format != 'DiGraph' or name is not None: self.name(name) g.add_vertices(scc_set) g.add_edges( set((scc_set[d[u]], scc_set[d[v]], label) for (u,v,label) in self.edges() ) ) else: g = DiGraph(multiple_edges=False, loops=False) g = DiGraph(multiedges=False, loops=False) g.add_vertices(scc_set) g.add_edges( (scc_set[d[u]], scc_set[d[v]]) for u,v in self.edges(labels=False) )
• ## sage/graphs/graph.py

`diff --git a/sage/graphs/graph.py b/sage/graphs/graph.py`
 a Whether to allow any object as a vertex (slower), or only the integers 0, ..., n-1, where n is the number of vertices. -  ``convert_empty_dict_labels_to_None`` - see the ``format`` argument documentation. EXAMPLES: def __init__(self, data=None, pos=None, loops=None, format=None, boundary=[], weighted=None, implementation='c_graph', sparse=True, vertex_labels=True, **kwds): sparse=True, vertex_labels=True, name=None, multiedges=None, convert_empty_dict_labels_to_None=None): """ TESTS:: """ GenericGraph.__init__(self) msg = '' multiedges = kwds.get('multiedges', None) from sage.structure.element import is_Matrix from sage.misc.misc import uniq if format is None and isinstance(data, str): format = 'NX' # At this point, format has been set. # adjust for empty dicts instead of None in NetworkX default edge labels kwds.setdefault('convert_empty_dict_labels_to_None', (format == 'NX')) # adjust for empty dicts instead of None in NetworkX default edge labels if convert_empty_dict_labels_to_None is None: convert_empty_dict_labels_to_None = (format == 'NX') verts = None self.add_edge(uu,vv) elif format == 'dict_of_dicts': if kwds.get('convert_empty_dict_labels_to_None', False): if convert_empty_dict_labels_to_None: for u in data: for v in data[u]: if hash(u) <= hash(v) or v not in data or u not in data[v]: self._pos = pos self._boundary = boundary name = kwds.get('name', None) if format != 'Graph' or name is not None: self.name(name)
• ## sage/graphs/graph_generators.py

`diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py`
 a for freea, freeb in Subsets(emptypegs, 2): edges.append([freea*nverts+state,freeb*nverts+state]) H = graph.Graph({}, loops=False, multiedge=False) H = graph.Graph({}, loops=False, multiedges=False) H.add_edges(edges) """ n = len(intervals) g = graph.Graph(vertices=range(n)) g = graph.Graph(n) edges = []