人工智能—状态空间法(state space)[三]

时间:2025-02-28 07:31:35
import pygraphviz as pgv      G = pgv.AGraph(strict=False, directed=True)      G.add_node('331')    G.add_edge('331','320') G.add_edge('331','220')   G.add_edge('331','310') G.add_edge('320','no way') G.add_edge('220','321') G.add_edge('310','321') G.add_edge('321','300') G.add_edge('300','110') G.add_edge('110','221') G.add_edge('221','020') G.add_edge('020','031') G.add_edge('031','010') G.add_edge('010','021') G.add_edge('010','111') G.add_edge('021','000') G.add_edge('111','000') G.graph_attr['label'] = u'M_C states'   G.node_attr['shape'] = 'circle'   G.edge_attr['color'] = 'blue'     s = G.to_string()      G.layout(prog='dot')   G.draw('')