Skip to content

Commit 656f6a7

Browse files
committed
Add str method that gives brief summary of the graph
1 parent fbdd8b6 commit 656f6a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pgraph/PGraph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def __init__(self, arg=None, metric=None, heuristic=None, verbose=False):
3333
else:
3434
self.heuristic = heuristic
3535

36+
def __str__(self):
37+
s = f"{self.__class__.__name__}: {self.n} vertices, {self.ne} edges, {self.nc} components"
38+
return s
39+
3640
@classmethod
3741
def Dict(cls, d, direction='BT', reverse=False):
3842

0 commit comments

Comments
 (0)