from phasic import Graph, with_ipv # ALWAYS import phasic first
import numpy as np
%config InlineBackend.figure_format = 'svg'
from vscodenb import set_vscode_theme
set_vscode_theme()Visualizing state space
@with_ipv([1, 1])
def mesh(state, max_val=2):
transitions = []
for i in range(state.size):
if state[i] <= max_val:
child = state.copy()
child[i] += 1
trans = [child, state.sum()]
transitions.append(trans)
return transitions
graph = Graph(mesh)
graph.plot()Change node separation from the default of 1:
Also change the separation of nodes with different rank from the default of 1:
Plot node rank top to bottom (TB) rather than default left to right (LR):
Width of edges, size of font, unicolor, and size of figure: