Created
October 23, 2012 04:04
-
-
Save anonymous/3936563 to your computer and use it in GitHub Desktop.
Red de Petri
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import snakes.plugins | |
snakes.plugins.load('gv', 'snakes.nets', 'nets') | |
from nets import * | |
n = PetriNet('Simple') | |
places = 6 | |
for i in range(places): | |
n.add_place(Place('P%s'%i, [], tInteger)) | |
n.add_transition(Transition('t',None)) | |
n.add_input('P0', 't', Variable('x')) | |
n.add_output('P1', 't', Expression('Video')) | |
n.add_output('P2', 't', Expression('Audio')) | |
n.add_output('P3', 't', Expression('Internet')) | |
n.add_transition(Transition('t1', None)) | |
n.add_input('P1', 't1', Variable('x')) | |
n.add_output('P4', 't1', Expression('video_x')) | |
n.add_transition(Transition('t2', None)) | |
n.add_input('P2', 't2', Variable('x')) | |
n.add_output('P4', 't2', Expression('sonido_x')) | |
n.add_transition(Transition('t3', None)) | |
n.add_input('P3', 't3', Variable('x')) | |
n.add_output('P5', 't3', Expression('descargar_x')) | |
n.add_transition(Transition('t4', None)) | |
n.add_input('P5', 't4', Variable('x')) | |
n.add_output('P4', 't4', Expression('stream_x')) | |
n.add_transition(Transition('t5', None)) | |
n.add_input('P4', 't5', Variable('x')) | |
for engine in ('neato', 'dot', 'circo', 'twopi', 'fdp') : | |
n.draw('output_%s.png'%engine, engine=engine) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment