-
Couldn't load subscription status.
- Fork 0
Edge and Bi Edge
Matthew Stern edited this page Mar 30, 2021
·
11 revisions
Edge
edge(vertex from, vertex to, edge_function = NULL, glbl = NULL)
Edge Function (vertex_to_shared_var is NULL in modes SWITCH and NONE)
>>> def edge_function(id, result_edge, edge_glbl, vertex_from_shared_var, vertex_to_shared_var)
#Do something
#Modify edge_glbl
return boolean, edge_glblCreate edge
>>> e = g.set_edge(vertex1, vertex2, edge_function, vars)
>>> #e = topylogic.edge(vertex1, vertex2, edge_function, vars)When you modify the vertex with set_f, or set_glbl it returns itself upon success and None upon failure. Thus, the calls can be chained.
>>> e = e.set_callback(...).set_glbl(...)Change the function
>>> e.set_callback(another_edge_function)Change the glbl vars
>>> e.set_glbl(new_vars)Destroy (Shouldn't be needed)
>>> e.destroy()Bi Edge (Like edge but creates a direction that points to and from both vertices. Thus has the same function)
bi_edge(vertex from, vertex to, edge_function = NULL, glbl = NULL)
Create a bi edge
>>> bi_e = g.set_bi_edge(vertex1, vertex2, edge_function, vars)
>>> #bi_e = topylogic.bi_edge(vertex1, vertex2, edge_function, vars) alternative
>>> edge_a = bi_e.edge_a_to_b
>>> edge_b = bi_e.edge_b_to_aWhen you modify the vertex with set_f, or set_glbl it returns itself upon success and None upon failure. Thus, the calls can be chained.
>>> bi_e = bi_e.set_callback(...).set_glbl(...)Change the function
>>> bi_e.set_callback(another_edge_function)Change the glbl vars
>>> bi_e.set_glbl(new_vars)Destroy (shouldn't be needed)
>>> bi_e.destroy()