% Creator: Finomaton 1.0
% Creation-Date: Sun Mar 09 23:39:56 CET 2008

input boxes
% Breadth of arrowheads (MetaPost default is 45)
ahangle := 35;
% Length of arrowheads (MetaPost default is 4bp)
ahlength := 4;
beginfig(1);
% for temporary paths (might be unused)
path p[];

% First, define and draw all the states
circleit.s334("1");
s334.c = (142.5, -85.0);
pickup pencircle scaled 1.2bp;
drawboxed(s334);
pickup defaultpen;

circleit.s336("2");
s336.c = (294.0, -81.0);
pickup pencircle scaled 1.2bp;
drawboxed(s336);
pickup defaultpen;

circleit.s338("3");
s338.c = (142.5, -257.5);
drawboxed(s338);
draw fullcircle scaled 0.85(ypart s338.n - ypart s338.s) shifted s338.c;

circleit.s340("4");
s340.c = (298.5, -260.5);
drawboxed(s340);


% Next, draw the lines
drawarrow (88.5, -50.5)..controls .5[(88.5, -50.5),(122.5, -60.5)] and .5[(122.5, -60.5),(s334.c)]..(s334.c) cutafter bpath s334;

drawarrow (308.0, -43.5)..controls .5[(308.0, -43.5),(314.5, -57.5)] and .5[(314.5, -57.5),(297.0, -71.5)]..(297.0, -71.5);

p351 = (s334.c)..controls .5[(s334.c),(163.5, -169.5)] and .5[(163.5, -169.5),(s338.c)]..(s338.c) cutbefore bpath s334 cutafter bpath s338;
drawarrow p351;
label.rt(btex b,e etex, point 0.5 of p351);

p355 = (s334.c)..controls .5[(s334.c),(171.0, -90.0)] and .5[(171.0, -90.0),(s340.c)]..(s340.c) cutbefore bpath s334 cutafter bpath s340;
drawarrow p355;
label.bot(btex a etex, point 0.5 of p355);

p359 = (s336.c)..controls .5[(s336.c),(360.5, -142.5)] and .5[(360.5, -142.5),(s340.c)]..(s340.c) cutbefore bpath s336 cutafter bpath s340;
drawarrow p359;
label.rt(btex a,e etex, point 0.5 of p359);

p363 = (s338.c)..controls .5[(s338.c),(243.0, -169.0)] and .5[(243.0, -169.0),(s336.c)]..(s336.c) cutbefore bpath s338 cutafter bpath s336;
drawarrow p363;
label.bot(btex b etex, point 0.5 of p363);

p367 = (s338.c)..controls .5[(s338.c),(119.0, -156.5)] and .5[(119.0, -156.5),(s334.c)]..(s334.c) cutbefore bpath s338 cutafter bpath s334;
drawarrow p367;
label.lft(btex a etex, point 0.5 of p367);

p374 = directionpoint dir 332 of bpath s340..controls (301.0, -300.0) and (301.0, -300.0)..directionpoint dir 405 of bpath s340;
drawarrow p374;
label.bot(btex a etex, point 0.5 of p374);

p378 = directionpoint dir 166 of bpath s334..controls (162.0, -43.0) and (162.0, -43.0)..directionpoint dir 133 of bpath s334;
drawarrow p378;
label.top(btex b etex, point 0.5 of p378);


% Finally, create labels

endfig;
end
