DiscreteStateBase#

class graph_tool.dynamics.DiscreteStateBase(g, make_state, params, s=None, stype='int32_t')[source]#

Bases: object

Base state for discrete-time dynamics. This class it not meant to be instantiated directly.

Methods

copy()

Return a copy of the state.

get_active()

Returns list of "active" nodes, for states where this concept is used.

get_state()

Returns the internal VertexPropertyMap with the current state.

iterate_async([niter])

Updates nodes asynchronously (i.e. single vertex chosen randomly), niter number of times.

iterate_sync([niter])

Updates nodes synchronously (i.e. a full "sweep" of all nodes in parallel), niter number of times.

reset_active()

Resets list of "active" nodes, for states where this concept is used.

set_active(active)

Sets the list of "active" nodes, for states where this concept is used.

copy()[source]#

Return a copy of the state.

get_active()[source]#

Returns list of “active” nodes, for states where this concept is used.

get_state()[source]#

Returns the internal VertexPropertyMap with the current state.

iterate_async(niter=1)[source]#

Updates nodes asynchronously (i.e. single vertex chosen randomly), niter number of times. This function returns the number of nodes that changed state.

iterate_sync(niter=1)[source]#

Updates nodes synchronously (i.e. a full “sweep” of all nodes in parallel), niter number of times. This function returns the number of nodes that changed state.

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

reset_active()[source]#

Resets list of “active” nodes, for states where this concept is used.

set_active(active)[source]#

Sets the list of “active” nodes, for states where this concept is used.