Skip to content
Snippets Groups Projects
Verified Commit 2ef03216 authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

:sparkles: allow to add property to an edge

parent 04cb6375
Branches
Tags
No related merge requests found
......@@ -51,6 +51,9 @@ class Edge:
"""the edge properties"""
return {k: v for k, v in self.__dict__.items()}
def __setitem__(self, key, value):
setattr(self, key, value)
class Graph(metaclass=ABCMeta):
"""
......@@ -98,6 +101,13 @@ class Graph(metaclass=ABCMeta):
yield n
def get_node_by_id(self, node_id):
nodes = self._nodes.keys()
for n in nodes:
if n.id == node_id:
return n
def nodes(self) -> Iterator[Node]:
"""
Iterates over all nodes belonging to the graph
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment