Skip to content

Commit 83dba3e

Browse files
committed
✨ add edge.set_directed() and edge.directed()
1 parent c5c79b4 commit 83dba3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pynode_next/edge.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ def weight(self):
8282
"""Returns the edge's weight. Returns an empty string if weight wasn't defined at init and hasn't been changed since."""
8383
return self._weight
8484

85+
def set_directed(self, directed=True):
86+
"""Sets whether or not the edge is directed"""
87+
self._directed = directed
88+
core.ax(lambda x: self._dispatch_wrapper(x, {"directed": directed}))
89+
return self
90+
91+
def directed(self):
92+
"""Returns whether or not the edge is directed"""
93+
return self._directed
94+
8595
def traverse(self, initial_node=None, color=Color.RED, keep_path=True):
8696
if initial_node == None:
8797
source = self._source

0 commit comments

Comments
 (0)