Skip to content

Commit

Permalink
fix add_edge to pass properties to edge instead of the SLelement #69
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecGoncharow committed Apr 10, 2020
1 parent 35ff7b3 commit 90438cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion bridges/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Edge():

def __init__(self, v1, v2, data=None) -> None:
def __init__(self, v1, v2, data=None, label: str = None, color: Color = None, thickness: float = None) -> None:
"""
Constructor for a edge
Args:
Expand All @@ -29,6 +29,15 @@ def __init__(self, v1, v2, data=None) -> None:
self._edge_data = data
self._lvis = LinkVisualizer()

if label:
self.label = label

if color:
self.color = color

if thickness:
self.thickness = thickness

@property
def tov(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions bridges/graph_adj_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def add_edge(self,
" does not exist! Add the vertex before creating the edge.")
except Exception as e:
traceback.print_tb(e.__traceback__)
self.adj_list[source_id] = SLelement(e=Edge(source_id, dest_id, data), next=self.adj_list.get(src), label=label,
color=color, thickness=thickness, opacity=opacity)
self.adj_list[source_id] = SLelement(e=Edge(source_id, dest_id, data, label=label, color=color,
thickness=thickness), next=self.adj_list.get(src))

return self.adj_list[source_id].value

Expand Down

0 comments on commit 90438cf

Please sign in to comment.