当前位置: 首页 > >

ʹÓÃGraphviz»æͼ£¨Ò»£©

发布时间:

תÔØ£ºhttp://www.cnblogs.com/taceywong/p/5439574.html
Ç°ÑÔ

ÈÕ³£¿ª·¢»òÕß±àд¿Î³ÌÂÛÎÄʱ£¬³ýÁË´úÂëÎĵµµÄ±àд£¬ÆäÖÐÒ»¸öºÜÖØÒªµÄ²¿·Ö¾ÍÊÇÐèÒª»æÖÆÁ÷³Ìͼ¡¢Ê¾Òâͼ


»æÖÆÁ÷³ÌͼÓкܶ๤¾ß£¬Ò»°ã³£¼ûµÄ¾ÍÓÐÈçϼ¸ÖÖ£º


  • Word¡¢PPTµÈ°ì¹«Èí¼þ
  • VisoÒÔ¼°¿ªÔ´µÄDia
  • »­Í¼£¨MSPaint£©¡¢PS¡¢AI
  • PicPicke
  • ÔÚÏßÁ÷³Ìͼ»æÖÆ£¨eg. www.processon.com£©

    ¶ÔÓÚÕâЩÈí¼þÎÞÂÛ¹¦ÄÜÇ¿´óÓë·ñ£¬ÊʺÏÓë·ñ£¬·½±ãÓë·ñ£¬¶¼¾ßÓÐÒ»¸öÌصã??Ëù¼û¼´ËùµÃ¡£ÄãÖÆ×÷¹ý³ÌÖп´µ½µÄ¾ÍÊÇ×îÖյõ½µÄ½á¹û¡£Í¼ÖÐÐÎʽ¡¢²¼¾ÖÔÚÖÆ×÷¹ý³ÌÖж¼ÓÉ×Ô¼ºÉèÖã¬Æäʵ»¹ÓÐÒ»Àà»æͼϵͳµÄ´æÔÚ£¬Æä˼ÏëÊÇ??Ëù˼¼´ËùµÃ¡£ÆäÖоßÓдú±íÐÔµÄÈí¼þ¾ÍÊÇ??Graphviz¡£GraphvizÊDZ´¶ûʵÑéÊÒ¿ª·¢µÄÒ»¸ö¿ªÔ´µÄ¹¤¾ß°ü£¬ËüʹÓÃÒ»¸öÌض¨µÄDSL£¨ÁìÓòÌض¨ÓïÑÔ£©??Dot×÷Ϊ½Å±¾ÓïÑÔ£¬È»ºóʹÓò¼¾ÖÒýÇæ½âÎö½Å±¾²¢Íê³É×Ô¶¯²¼¾Ö¡£GraphvizµÄÉè¼Æ³õÖÔÊǶÔͼ½øÐÐ×Ô¶¯²¼¾Ö£¨ÓÐÏòͼ¡¢ÎÞÏòͼ¡¢£©£¬¿ÉÒÔʹÓÃdot½Å±¾À´¶¨ÒåͼÐÎÔªËØ£¬Ñ¡ÔñÒ»¶¨µÄËã·¨½øÐв¼¾Ö£¬Í¨¹ý¶ÔÊäÈë½Å±¾µÄ½âÎö£¬·ÖÎö³öÆäÖеĵ㣬±ßÒÔ¼°×Óͼ£¬È»ºó¸ù¾ÝÊôÐÔ½øÐлæÖÆ£¬¼Ì¶ø½«½á¹ûÒÔ×Ô¼ºÐèÒªµÄ¸ñʽµ¼³öÀ´¡£


    Ïà¶ÔÓÚÆäËûµÄ»æͼÈí¼þ£¬GranphvizµÄÌصãÓÐÈçϼ¸¸ö·½Ã棺


    • ´úÂë¿ØÖÆ£¬Ëù˼¼´ËùµÃ
    • ²¼¾ÖÒýÇæ×Ô¶¯²¼¾Ö
    • £¨µ¼³ö¸ñʽ·Ç³£·á¸»£©

      Èçϼ´ÎªGraphivz¹ÙÍøÉϵÄһЩʾÀýЧ¹û£º





      Ò»¸öÉú³ÉÓÐÏòͼµÄСÀý×Ó

      ÎÒÃÇÏÈÀ´¿´Ò»¸öСÀý×ÓÀ´¿´Ò»ÏÂʹÓÃGraphviz»æÖÆÒ»ÕÅͼµÄÍêÕûÁ÷³Ì£¨ÎÒʹÓõÄÊÇUbuntu 14.04 LTS£¬ÔÚÆäËüϵͳÉϵÄʹÓÃÓ¦¸Ã²î²»¶à£¬ÏÂÃæ²»ÔÙ±ê×¢ÁË£©¡£


      ҪʹÓÃGraphviz£¬ÏÈÒªÔÚϵͳÉ*²×°Graphviz¡£ÔÚUbuntuÉÏ¿ÉÒÔʹÓÃÃüÁîsudo apt-get install graphviz½øÐа²×°£¬ÔÚÆäËûϵͳ°²×°µÄ·½·¨¿ÉÒԲ鿴Graphviz¹ÙÍø½øÐв鿴¡£³ÌÐò°²×°ºÃÖ®ºóÎÒÃǾͿÉÒÑʹÓÃÁË¡£


      Step 1£ºÊ×ÏÈ£¬ÐèÒª±à¼­dot½Å±¾


      ¿ÉÒÔʹÓÃÄãÊìϤµÄ´¿Îı¾±à¼­Æ÷½øÐнű¾±àд£¨±ØÐëÊÇ´¿Îı¾±à¼­Æ÷£¬Èçvim¡¢notepad++£¬ÏñwordÕâÑùµÄ¸»Îı¾±à¼­Æ÷ÊDz»Ðеģ©£¬Ö»ÐèÉèÖñàÂëΪUTF-8¡£


      ±à¼­ÏÂÃæµÄ½Å±¾´úÂ룬±£´æΪtest.dot£¨ÏȲ»ÓùÜÆä¾ßÌåµÄÒâ˼£¬Ö±½Ó¸´ÖƾÍÐÐÁË£©£º



      digraph G{
      main -> parse -> execute;
      main -> init;
      main -> cleanup;
      execute -> make_string;
      execute -> printf;
      init -> make_string;
      main -> printf;
      execute -> compare;
      }


      Step 2:Ëæºó£¬Ñ¡Óò¼¾ÖÉú³É½á¹û


      ʹÓÃÈçÏÂÃüÁîÉú³É½á¹û£º
      dot -Tpng sample.dot -o sample.png


      ¶ÔÓÚÕâÌõÃüÁdot±íʾÓÃdot²¼¾Ö£¬-Tpng±íʾÉú³ÉpngͼƬ¸ñʽ£¬sample.dotÊǽű¾ÎļþÃû£¬-o sample.png±íʾÉú³ÉÊä³öµÄͼƬÃû³Æ¡£


      ¸ÄÃüÁîÒ²¿ÉÒÔд³Édot -Kdot -Tpng sample.dot -o sample.png,ÆäÖÐ-Kdot±íʾʹÓÃdot²¼¾Ö¡£


      GraphvizÖ§³Ö¼¸ÖÖ²¼¾ÖÒýÇ棺


      • dot £º ĬÈϲ¼¾Ö·½Ê½£¬Ö÷ÒªÓÃÓÚÓÐÏòͼ
      • neato £º Ö÷ÒªÓÃÓÚÎÞÏòͼ
      • twopi £º Ö÷ÒªÓÃÓÚ¾¶Ïò²¼¾Ö
      • circo £º Ô²»·²¼¾Ö
      • fdp £º Ö÷ÒªÓÃÓÚÎÞÏòͼ
      • sfdp £º Ö÷Òª»æÖ*Ï´óµÄÎÞÏòͼ
      • patchwork £º Ö÷ÒªÓÃÓÚÊ÷¹þϣͼ£¨tree map£©

        GraphvizÖ§³ÖµÄÊä³öͼƬ¸ñʽ¸üÊÇÏ൱µÄ¶à£¬³£ÓõÄÓÐÒÔϼ¸ÖÖ£º


        • pdf £º
        • gif
        • png £º
        • jpeg £º Ò»ÖÖÓÐËðѹËõͼƬ¸ñʽ
        • bmp £º Ò»ÖÖλͼ¸ñʽ
        • svg £º ʸÁ¿Í¼£¬Ò»°ãÓÃÓëWeb£¬£¬¿ÉÒÔÓÃä¯ÀÀÆ÷´ò¿ª
        • ps £º ʸÁ¿Ïßͼ£¬¶àÓÃÓÚ´òÓ¡
          ¸ü¶àµÄÊä³ö¸ñʽ¿ÉÒÔä¯ÀÀGraphvizÊä³ö¸ñʽ½øÐв鿴¡£

          Step 3£º²é¿´Éú³É½á¹û


          Êä³öµÄͼƬ£¬¿ÉÒÔÓÃÖ§³ÖÏàӦͼƬ¸ñʽµÄÈí¼þ´ò¿ª¡£GraphvizÈí¼þ°²×°ºÃÖ®ºó£¬ÓÐÒ»¸öͼƬä¯ÀÀÆ÷¿ÉÒÔ½øÐÐͼƬԤÀÀ£¬Ö»ÐèÊäÈëÃüÁîdisplay sample.png¼´¿É£¨sample.pngΪÉú³ÉµÄͼƬÎļþÃû£©£¬¸ÃʾÀýÔ¤ÀÀ½á¹ûÈçÏÂ(Äã¿ÉÒÔÔÚÉÏÒ»²½Ê¹Óò»Í¬µÄ²¼¾Ö·½Ê½£¬²é¿´Ò»Ï½á¹ûÓÐʲô²»Í¬)£º



          ÕýÈ·Íê³ÉÈý¸ö²½ÖèµÃµ½½á¹û˵Ã÷GraphvizÒѾ­¿ÉÒÔÔÚÄãµÄϵͳÖÐÕýÈ·°²×°¿ÉÒÔʹÓÃÁË¡£ºóÐøÎÒ»á½éÉÜGraphviz Dot½Å±¾µÄ¾ßÌå±àд·½·¨¡£


相关推荐


友情链接: