* bir de edge list'den cevirmek icin birsey yaz
This commit is contained in:
@@ -20,6 +20,11 @@ class digraph(object):
|
|||||||
l.append( (u,v) )
|
l.append( (u,v) )
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
def from_edge_list(self, el):
|
||||||
|
"convert a list of edges (u,v) to graph"
|
||||||
|
for (u,v) in el:
|
||||||
|
self.add_edge(u,v)
|
||||||
|
|
||||||
def add_vertex(u, data = None):
|
def add_vertex(u, data = None):
|
||||||
"add vertex u, optionally with data"
|
"add vertex u, optionally with data"
|
||||||
assert not u in self.__v
|
assert not u in self.__v
|
||||||
|
|||||||
Reference in New Issue
Block a user