Skip to content

Commit

Permalink
Arrange the order of methods
Browse files Browse the repository at this point in the history
  • Loading branch information
junkawahara committed Dec 14, 2024
1 parent c0b766c commit d0e9726
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 74 deletions.
74 changes: 37 additions & 37 deletions graphillion/edgevertex_setset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,43 +1346,6 @@ def probability(self, probabilities):
probabilities = {EdgeVertexSetSet._conv_edgevertex(ev): p for ev, p in probabilities.items()}
return self._ss.probability(EdgeVertexSetSet._objtable, probabilities)

def dump(self, fp):
"""Serialize `self` to a file `fp`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> fp = open('/path/to/graphset', 'wb')
>>> gs.dump(fp)
>>> fp = open('/path/to/universe' 'wb')
>>> pickle.dump(EdgeVertexSetSet.universe(), fp)
Args:
fp: A write-supporting file-like object.
See Also:
dumps(), load()
"""
return self._ss.dump(fp)

def dumps(self):
"""Returns a serialized `self`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> graphset_str = gs.dumps()
>>> universe_str = pickle.dumps(EdgeVertexSetSet.universe())
See Also:
dump(), loads()
"""
return self._ss.dumps()

def cost_le(self, costs, cost_bound):
"""Returns a new EdgeVertexSetSet with subgraphs whose cost is less than or equal to the cost bound.
Expand Down Expand Up @@ -1494,6 +1457,43 @@ def cost_eq(self, costs, cost_bound):
lt_ss = self._ss.cost_le(objtable=EdgeVertexSetSet._objtable, costs=costs, cost_bound=cost_bound - 1)
return EdgeVertexSetSet(le_ss.difference(lt_ss))

def dump(self, fp):
"""Serialize `self` to a file `fp`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> fp = open('/path/to/graphset', 'wb')
>>> gs.dump(fp)
>>> fp = open('/path/to/universe' 'wb')
>>> pickle.dump(EdgeVertexSetSet.universe(), fp)
Args:
fp: A write-supporting file-like object.
See Also:
dumps(), load()
"""
return self._ss.dump(fp)

def dumps(self):
"""Returns a serialized `self`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> graphset_str = gs.dumps()
>>> universe_str = pickle.dumps(EdgeVertexSetSet.universe())
See Also:
dump(), loads()
"""
return self._ss.dumps()

@staticmethod
def load(fp):
"""Deserialize a file `fp` to `self`.
Expand Down
74 changes: 37 additions & 37 deletions graphillion/graphset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1507,43 +1507,6 @@ def probability(self, probabilities):
probabilities = {GraphSet._conv_edge(e): p for e, p in probabilities.items()}
return self._ss.probability(GraphSet._objtable, probabilities)

def dump(self, fp):
"""Serialize `self` to a file `fp`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> fp = open('/path/to/graphset', 'wb')
>>> gs.dump(fp)
>>> fp = open('/path/to/universe' 'wb')
>>> pickle.dump(GraphSet.universe(), fp)
Args:
fp: A write-supporting file-like object.
See Also:
dumps(), load()
"""
return self._ss.dump(fp)

def dumps(self):
"""Returns a serialized `self`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> graphset_str = gs.dumps()
>>> universe_str = pickle.dumps(GraphSet.universe())
See Also:
dump(), loads()
"""
return self._ss.dumps()

def cost_le(self, costs, cost_bound):
"""Returns a new GraphSet with subgraphs whose cost is less than or equal to the cost bound.
Expand Down Expand Up @@ -1757,6 +1720,43 @@ def to_edgevertexsetset(self):
"""
return EdgeVertexSetSet(self._ss.to_edgevertexsetset(GraphSet._objtable))

def dump(self, fp):
"""Serialize `self` to a file `fp`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> fp = open('/path/to/graphset', 'wb')
>>> gs.dump(fp)
>>> fp = open('/path/to/universe' 'wb')
>>> pickle.dump(GraphSet.universe(), fp)
Args:
fp: A write-supporting file-like object.
See Also:
dumps(), load()
"""
return self._ss.dump(fp)

def dumps(self):
"""Returns a serialized `self`.
This method does not serialize the universe, which should be
saved separately by pickle.
Examples:
>>> import pickle
>>> graphset_str = gs.dumps()
>>> universe_str = pickle.dumps(GraphSet.universe())
See Also:
dump(), loads()
"""
return self._ss.dumps()

@staticmethod
def load(fp):
"""Deserialize a file `fp` to `self`.
Expand Down

0 comments on commit d0e9726

Please sign in to comment.