Graph.add_bidirected_edge
Add a bi-directed edge into the graph
Usage
add_bidirected_edge(v_from:int, v_to:int, weight:tuple = (1,1))
Parameters:
v_from : int
The origin vertice
v_to : int
The destination vertice
weight : tuple
The weight/cost of the edge in the form (v_from -> v_to, v_to -> v_from)
Example
from jellybeans.structures import Graphg = Graph()g.add_vertex(1)g.add_vertex(5)g.add_bidirected_edge(1, 5, (20, 30))print(g.to_adj_list()) # {1: [(5, 20)], 5: [(1, 30)]}