-
Couldn't load subscription status.
- Fork 0
Vertex
Matthew Stern edited this page Mar 30, 2021
·
7 revisions
Vertex:
vertex(graph, id, vertex_function = NULL, glbl = NULL)
A vertex function
>>> def v_fun(vertex_id, graph, result_vertex, result_edge, vertex_glbl, vertex_edge_vars):
#Do something
#Modify result_vertex, result_edge, vertex_glbl, vertex_edge_vars
#sumbit a request to the graph
return result_vertex, result_edge, vertex_glbl, vertex_edge_varsCreate vertex (the id must be unique)
>>> v = g.set_vertex(g, v_fun, id, var)
>>> #v = topylogic.vertex(g, v_fun, id, var) alternativeWhen you modify the vertex with set_f, set_glbl, or set_shared_edge_vars it returns itself upon success and None upon failure. Thus, the calls can be chained.
>>> v = v.set_callback(...).set_glbl(...)Modify the vertex callback function
>>> v = v.set_callback(another_vertex_func)Modify the vertex variables
>>> v = v.set_glbl(another_var)Modify the shared variables with the edge
>>> v = v.set_shared_edge_vars(vars)Destroy vertex (you shouldn't need to call this)
>>> v.destroy()