Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and get started with Graphviz under windows

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains how to install and get started with Graphviz under windows. The content is clear. Interested friends can learn about it. I believe it will be helpful after reading it.

Download installation configuration environment variable intall configuration environment variable validation basic drawing introduction graphdigraph A complex example interacts with python

Discovering good tools is like discovering a new world. Sometimes, we wonder how such vivid illustrations in papers and various professional books are made, without exception, it is not the skillful use of drawing tools.

Download, install and configure environment variables

Intall

Double-click the msi file, and then keep next (remember the installation path, which will be used to configure the environment variables later). After the installation is complete, shortcut information is created in the windows start menu, and the default shortcut is not placed on the desktop.

Configure environment variables

Add the bin folder under the graphviz installation directory to the Path environment variable:

Verification

Enter the windows command line interface, type dot-version, and then press enter. If the relevant version information of graphviz is displayed, the installation and configuration is successful.

Introduction to basic drawing

Open the graphviz editor gvedit under windows, write the following dot scripting language, and save it as a text file in gv format. Then enter the command line interface and use the dot command to convert the gv file into a png drawing file.

Dot D:\ test\ 1.gv-Tpng-o image.png

Graph

Graph use-- describe relationships

Graph pic1 {a-b a-b b-a [color=blue]}

Digraph

Use-> to describe the relationship

Digraph pic2 {a-> b a-> b b-> a [style=filled color=blue]}

A complex example

Digraph startgame {label= "game resource update process" rankdir= "TB" start [label= "launch game" shape=circle style=filled] ifwifi [label= "network environment to determine whether WIFI" shape=diamond] needupdate [label= "has resources to update" shape=diamond] startslientdl [label= "silently download" shape=box] enterhall [label= "into the game hall" shape=box] enterroom [label= "enter the room" shape=box] resourceuptodate [label= "incomplete resources shape=diamond] startplay [label= "normal Game" shape=circle fillcolor=blue] warning [label= "reminds players whether to update" shape=diamond] startdl [label= "enter the download interface" shape=box] / / {rank=same Needupdate, enterhall} {shape=diamond Ifwifi Needupdate} start-> ifwifi ifwifi- > needupdate [label= "is"] ifwifi- > enterhall [label= "No"] needupdate- > startslientdl [label= "is"] startslientdl- > enterhall needupdate- > enterhall [label= "No] enterhall-> enterroom enterroom-> resourceuptodate resourceuptodate-> warning [label=" is "] resourceuptodate-> startplay [label=" No] warning-> startdl [label= "confirm download"] warning-> enterhall [label= "cancel download] startdl-> enterhall [label=" cancel download " ] startdl-> startplay [label= "download completed]}

Interact with python

Graphviz's powerful and convenient method of drawing diagrams / flowcharts easily reminds us of the presentation of Decision Tree in machine learning. Fortunately, scikit-learn provides an interface to generate .dot files, as follows:

In the python editing environment:

From sklearn.tree import export_graphviz # imports a function # tree that represents the trained model, that is, the fit (X_train, y_train) method export_graphviz (tree, out_file='tree.dot', feature_names= ['petal length',' petal width']) of the DecisionTreeClassifier instance has been called

Enter the windows command line interface, cd changes to the path where tree.dot is located, and execute

Dot-Tpng tree.dot-o tree.png

After reading the above content, do you have a further understanding of how to install and get started with Graphviz under windows? if you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report