Skip to content

Commit

Permalink
✨ add graph.remove_all()
Browse files Browse the repository at this point in the history
  • Loading branch information
ehne committed Aug 14, 2021
1 parent ff02d99 commit 91d324f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pynode_next/graph.py
Expand Up @@ -147,6 +147,15 @@ def add_all(self, elements: Iterable[Union[Node, Edge]]):
elif isinstance(i, Edge):
self.add_edge(i)
pause(20)

def remove_all(self, elements: Iterable[Union[Node, Edge]]):
"""Removes all node and edge objects from an iterable. all elements need to be of the type `Node` or `Edge`"""
for i in elements:
if isinstance(i, Node):
self.remove_node(i)
elif isinstance(i, Edge):
self.remove_edge(i)
pause(20)

def has_edge(self, edge):
"""Checks if an edge exists in the graph."""
Expand Down

0 comments on commit 91d324f

Please sign in to comment.