🔧 chore(base.py): add __repr__ method to Graph class for better debugging and representation
This commit is contained in:
parent
d8dee14ed5
commit
650275db8a
1 changed files with 7 additions and 0 deletions
|
|
@ -214,3 +214,10 @@ class Graph:
|
||||||
if node_type in node_types:
|
if node_type in node_types:
|
||||||
children.append(node)
|
children.append(node)
|
||||||
return children
|
return children
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
node_ids = [node.id for node in self.nodes]
|
||||||
|
edges_repr = "\n".join(
|
||||||
|
[f"{edge.source.id} --> {edge.target.id}" for edge in self.edges]
|
||||||
|
)
|
||||||
|
return f"Graph:\nNodes: {node_ids}\nConnections:\n{edges_repr}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue