Commit 0c4b511c authored by Tiago Peixoto's avatar Tiago Peixoto

Implemet __copy__ in Graph and PropertyMap

parent 808318a6
...@@ -445,6 +445,9 @@ class PropertyMap(object): ...@@ -445,6 +445,9 @@ class PropertyMap(object):
the value type is converted to the chosen type.""" the value type is converted to the chosen type."""
return self.get_graph().copy_property(self, value_type=value_type) return self.get_graph().copy_property(self, value_type=value_type)
def __copy__(self):
return self.copy()
def get_graph(self): def get_graph(self):
"""Get the graph class to which the map refers.""" """Get the graph class to which the map refers."""
g = self.__g() g = self.__g()
...@@ -1141,6 +1144,9 @@ class Graph(object): ...@@ -1141,6 +1144,9 @@ class Graph(object):
are also copied.""" are also copied."""
return Graph(self) return Graph(self)
def __copy__(self):
return self.copy()
def __repr__(self): def __repr__(self):
# provide more useful information # provide more useful information
d = "directed" if self.is_directed() else "undirected" d = "directed" if self.is_directed() else "undirected"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment