MAKEGRAPHdocumentationD.AustinHenderson,Jr.Lastrevised:March17,1983MAKEGRAPH(and.DCOM)isapackagewhichsitsontopofGrapherandhelpsonecreategraphsdepictingadatastructurebywalkingthroughit.Thecentralideaisthateachpointinthewalk(andnodeinthegraph)ischaracterizedbyadatum/statepairandmotionisdefinedbyagraphspecificationintheformofstatetransitionfunction.Thisfunctionisspecifiedbyacollectionofstatespecifications,eachofwhichindicateshowtodisplay(labelandfont)thedatumwhenoneisinthatstateandhowtofindthedatum/statepairswhicharethesonsofthatnode.Alsothestatespecificationmayspecifyadditionalrootsforthewalk.Thegenerationofabranchofthegraphceaseswheneithertherearenosonsofanode,oranalreadyencounterednodeisrevisited(identicaldatumandidenticalstate).Thepackagecontainsafunctionforcreatingsuchgraphsandanexampleofitsuse:afunctionwhichgraphsthegraphspecificationsthemselves.Commentsarewelcomed.Themainfunctions:MAKE.GRAPH(WINDOWTITLEGRAPH.SPECIFICATIONROOTSCONTEXTLEFTBUTTONFNMIDDLEBUTTONFNTOPJUSTIFYFLGDEPTH)CreatesaMAKEGRAPHwindow.IfWINDOWisNIL,thenanewonewillbecreatedandtheuserwillbepromptedtopositionit.Otherwise,thegraphwillbeshowninWINDOW.ThewindowwillbetitledwithTITLE,willcallLEFTBUTTONFNandMIDDLEBUTTONFNonnodesselected(orNILifselectionismadewherenonodeispositioned),andwillbejustifiedasindicatedbyTOPJUSTIFYFLG(alaGrapher).ThebuttonfunctionsaredefaultedtoMAKE.GRAPH.LEFTBUTTONFN(whichscrollsthewindowsothattheselectednodeisinthemiddleofthewindow,oriftheleftshiftkeyisdepressed,printsoutinformationaboutit)andMAKE.GRAPH.MIDDLEBUTTONFN(whichprovidesamenuoftwochoices:INSPECT-inspectsthedatumofthenodeselected,oriftheleftshiftkeyisdepressed,inspectsthenodeitself;andSUB.GRAPH-whichopensanotherMAKEGRAPHwindowwiththesameparametersasthisone,butwithgraphstartingattheselectednode).TheargumentstoMAKE.GRAPHareaddedaspropertiestothewindowundertheirargumentnames.SelectinginthetitleinvokesthefunctionswhicharethevaluesofthewindowpropertiesTITLE.LEFTBUTTONFNandTITLE.MIDDLEBUTTONFN(notinthecallingsequence;setbytheuserifdesired;calledwithasingleargument-WINDOW;defaultedtoafunctionwhichprovidesamenuofUPDATEandSHOW.GRAPH.SPEC(seefunctionalitybelow)).ThegraphiscreatedaccordingtotheGRAPH.SPECIFICATION(seebelow)todepthDEPTH,startingfromROOTSwhichare(DATUM.STATE)pairs.CONTEXTisanextraargumentwhichisapassedalongtoallaccessingexpressions.AGRAPH.SPECIFICATIONisapropertylistofSTATE.SPECIFICATIONswherethepropertiesarethestatenames.ASTATE.SPECIFICATIONisapropertylistwhosepropertiesandvaluesareasfollows(inthis,EXPRmeansaLISPformwhichwillbeevaluatedinanenvironmentinwhichDATUMisboundtothenode'sdatum,STATEtothenode'sstate,andCONTEXTtocontext):LABEL:anexpressionreturningsomethingwhichwillbeprintedasthelabelofthenode;ifnoLABELpropertyisprovided,thestring"???"willbeused.FONT:anexpressionreturningthefonttobeusedforthisnode;ifnoFONTpropertyisprovided,thedefaultfontforthegrapherwillbeused.SONS:aformindicatingalistof(DATUM.STATE)pairstobeusedingeneratingthesonsofthisnode;theacceptableformsareanyofthefollowing:(data-expressionstate-expression)wheredata-expressionreturnsalistofdatum'sforthesonnodes,andstate-expressionisevaluatedinthecontextofeachoftheseinturntoproducethecorrespondingstateofeach.(LIST(datum-expressionstate-expression)...(datum-expressionstate-expression))atemplateofexpressionswhichareevaluatedindividuallytoproducealistofsonsofthesameform,viz.(DATUM.STATE)pairs.(EVALexpression)theexpressionreturnsalistof(DATUM.STATE)pairsofthesons.(UNIONsons-spec...sons-spec)whereeachsons-specisanyoftheseforms(recursively).(TRACEsons-spec)adeviceforhelpingdebuggraphspecifications;thevalueisthevalueofsons-specs;theuserisgiventhechancetoINSPECTthemaftertheyhavebeengenerated.ROOTS:likeSONS,excepttheresulting(DATUM.STATE)pairsareusedaspossiblyadditionalrootsofthegraph.MAKE.GRAPH.CONSTRUCT(GRAPH.SPECIFICATIONINITIAL.ROOTSCONTEXTDEPTH)ThisisthefunctionalheartofMAKE.GRAPHbrokenoutforthosewhowishtohandletheirowninteractswithgrapherandthewindowpackage.ItproducesalistofgraphnodeswithlabelsandsonsasspecifiedbyGRAPH.SPECIFICATION(seeMAKEGRAPH),startingfromINITIAL.ROOTSwhichare(DATUM.STATE)pairs.CONTEXTisanextraargumentwhichisapassedalongtoallaccessingexpressions.Returnsthelistofgraphnodes.p c/ b6qP ;b6b6Ab6 ` oP ` _"n__"t_ ]]] ]r]%]s]&'(-13589?ADGuGu] \V"'#(-/h26g91:o=@C~DG/JEJJ\V Z /T "q$?%<%N?K?KZZC ?KZ J]ZZJJZ YP j^` K!$*+X023 9;6;6YPYP>8 ;6Y2 FYPYPFIIYP W uR%WWW!WW"K$$WW$Wg';WW( *=.]14`579<?HBCF\HHW VJ dnVJVJV, MVJVJ "0$(i+h-0 8H;? EEVJVJEV,HVJVJIIVJ T *@ \Y"$Q&*?.(15j8:<?A-B*EG[IIT SD 2u! &**SDtSD-SDsSD-p269G>XCDIISD Q B"$a& ()/27/9`= ENENQ P+ !&P+qP+!,P+ Nu NNqNN M&r 9 16>7 J3J3M& K  %0*KqK*K Js!(()T,/03D58<9>A!CRFHJ[J[J H !%(+). /69{>u@BFIIH G 1 # 1V3.6;=@BGHHG E{d< "% &+-i3)4 @BXCIIE D !&7Y;?AFHlHlD B 6!]"%*k,-4/e1468; >BtDDB A ?26BE0HsHs?} =g".'058:>N E#FII= CGII: 9q  03 EHJJ9q 7 N~m;l 7!j&{*A-,.)178@EGwHtHt7 6k1kh%(f6e9 @EHH6k 4~ </167;N@EHH4 3el"k%-2.p033w9p=M>?CGMHJJ3e 1 1q11 0Vs I*he$&(g(9{=d? EGJ0J00V . X#%-&*+-1 7:l>j@BFHH. -P >v!S#%+- . 68'<ACGBHH-P + : :"Y%(</06<+q+6B+ *As ")f-C/16$79=>@DzEGG*A (J"V%(3)-(q(-( '2s ) 1"$p&3)@+O-1}248>I?E~GG'2 %a /`F"%q%"% $#s B?M%'%+&.S/146# <>ACFEItIt$# "  Syw %"q"%" !s",h0135:}<>AE8GG! Iz$%(*5-/13e8: C~FH H   q  s crs4$V%0;<AC JJ  D$%'),a-03l69V?@TEHqH Rs cRrRRsRk j !#$&(:./8479@;q>PRqR>VR s cr<sv ."%*,9.0737M >q>  s c r  s u (%9H# ' *3q59:Z<@AA  AG  HoJJ f x  $C'P*1-I0w 6fqf6f sQ"'-.379&<3=B II W,WqWW r/b :AG=qGC [s C v &+/-u/258:I>ADII[  Duo!#!()+-b 47y;)=@BGIjIj Uj )-1 <?BHgII U :?!F'?+,Z-W1568]> EtJ{J{ O ) OqOO` q?[MAKE.GRAPH.FIND.ROOTS(GRAPH.SPECIFICATIONINITIAL.ROOTSCONTEXTDEPTH)Findstherealrootsfromasetofinitialroots,usingthesameprocessingasMAKEGRAPHuses.Thisishelpfulwhenyouwanttohanda"correct"setofrootsofastructuretoMAKEGRAPHwithouthavingtoexplorethedependencieswithinthatstructure.AswithMAKEGRAPH,thedatastructureisprocessedaccordingtotheGRAPH.SPECIFICATION(seeMAKEGRAPH),startingfromINITIAL.ROOTSwhichare(DATUM.STATE)pairs.CONTEXTisanextraargumentwhichisapassedalongtoallaccessingexpressions.Returnstherealrootsasalistof(DATUM.STATE)pairs.Supportingfunctions:MAKE.GRAPH.UPDATE.WINDOW(WINDOW)Usesthewindowproperties(whichmayhavebeenchanged)toreinvokeMAKE.GRAPHonthewindow.MAKE.GRAPH.SHOW.LIST(OBJECT)Thisisasimpleexamplefunction.Supposewewantedtolayoutliststructureasagraph.Inthegraph,wewantedalisttobelabeledby"()"anditssonstobetheelementsofthelist.Forexample,thegraphof'(AB(CD))shouldlooksomethinglike:A/()-BC\/()\DMAKE.GRAPH.SHOW.LISTusesMAKE.GRAPHtoproducesuchgraphs.ItpresentsOBJECTasatreewhosenodesareLISTPsandwhoseleavesarenon-LISTPs.Thelayoutspecificationthatituses(savedinthevalueofthevariableMAKE.GRAPH.LIST.SPEC)isincludedhereasanexampleofasimple,1-stategraph.specification.(OBJECT(DOC(ANYLISPOBJECT)-somedocumentationLABEL(COND((LISTPDATUM)"()")(TDATUM))SONS((COND((LISTPDATUM)DATUM)(TNIL))(QUOTEOBJECT))))MAKE.GRAPH.SHOW.SPEC(GRAPH.SPECIFICATION)UsesMAKE.GRAPHtoproducedagraphofaGRAPH.SPECIFICATION.Itusesasthegraph.specificationforthislayoutthevalueofthevariableMAKE.GRAPH.SPEC.SPECwhichpresentsGRAPH.SPECIFICATION(reflectively)asagraph.specification.(GRAPH.SPECIFICATIONcanserveasatemplateforothergraph.specifications.Itisafairlycomplex9-statespecification.)MAKE.GRAPH.EXAMPLE.1()CallsMAKE.GRAPH.SHOW.SPEConMAKE.GRAPH.SPEC.SPEC.ForamorecomplexexampleseeaboveunderMAKE.GRAPH.SHOW.SPEC.)MAKE.GRAPH.EXAMPLE.2()CallsMAKE.GRAPH.SHOW.LISTonMAKE.GRAPH.LIST.SPEC;thatis,producesagraphofthissimplegraph.specificationasalist.NoticethatselectingthetitlecommandUPDATEinthiswindowwillyieldadifferentgraphofthesamestructure,viz.asagraph.specification.Otherusefulfunctions:MAKE.GRAPH.DATUM(NODE)ReturnstheDATUMassociatedwiththegraphnodeNODE.MAKE.GRAPH.STATE(NODE)ReturnstheSTATEassociatedwiththegraphnodeNODE.MAKE.GRAPH.FATHER(NODE)ReturnsthegraphnodewhichisthefatherofthegraphnodeNODE. c8 b6r/b :AG=b6qb6GCb6 `sSD!%)+B. 5 6@nCFzGG` _v2$&(+S,-3f4>CGIkIk_ ] 0 &(+ 57:@JAGG] \ w%(( 27: EII\ Z _^$%%c'&*j0c4@5~6{:>@?AG7G7Z Y KR M !#%d+,b14YqY4Y W~u  W`.W~qW~W~ Ur!)gUqU)mU TTs >8 |"%(.0%5 ?ACHTTqTTHTT RrM#RqR#R QXs C)$&+g,028}9:??gA C:GOIIIIQX Oh6!i#%'u)8+i02~477l9?AEvGI1JoJoO NR  jR^NRqNRdNR L L K oF#K JJ oLJJ H H G oG FB oFFB D oFD C oFC B: B: @s=  *@+0388:#?KDFG|JJ@ ?+! #&" -04 @BFHuJJ?+ =d %)*R/2425;=<=BQF|F|= <%X<% : : 9Sq;$%&'x(O)&)*+,-Y.0/04 ?9S 7e<FP$),n//7 6[2 <##6 5Ke<oP$).5K 3[2 <!u3 2e<oF'$2 1C oFV1C / / . . -;r/-;q-;/-; +s E $l%&8,9v~?{C8DG5G5 4j#&L+-06<>i@EHPHP !O Z %='')*'f 5&5}q5 u )q yryqyy s" 1!#M' *M.q. }r}q}} s" 2 "N& )N-q- r "q ( s""= n$A%'+.3q3 q?[{ TIMESROMAN  TIMESROMAN  TIMESROMAN  TIMESROMAN ~GACHA ~GACHA  j/"{PHYLUM}MAKEGRAPH.TED;1 BURTON.PA21-Mar-84 11:29:48