From 6bca1d927a4762bdaadc5b38b29b5f3235b70ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Mon, 18 Jul 2005 00:55:56 +0000 Subject: [PATCH] * bir de edge list'den cevirmek icin birsey yaz --- pisi/graph.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pisi/graph.py b/pisi/graph.py index fad737a2..9941750d 100644 --- a/pisi/graph.py +++ b/pisi/graph.py @@ -20,6 +20,11 @@ class digraph(object): l.append( (u,v) ) 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): "add vertex u, optionally with data" assert not u in self.__v