0

I did install the Graphviz from this link: http://www.graphviz.org/download/, and since I have windows, I used this version: graphviz-4.0.0 (64-bit) EXE installer [sha256]. I am not familiar with this program, and now I don't know where I should write my codes? There is no shortcut on my desktop. Do I need any other software like Python to be able to use this program? I couldn't find any tutorial for a super beginner; I would be grateful if someone could help me!

2 Answers 2

1

If you followed the default installation options...

enter image description here

...then GraphViz will be installed here:

C:\Program Files\Graphviz

To verify this, you can run one of the programs it uses - such as dot.exe.

1 - Open a command promt.

2 - Run the following command:

"C:\Program Files\Graphviz\bin\dot" -V

Note the uppercase V.

That will print the installed version number to confirm that the installation was succesful:

dot - graphviz version 4.0.0 (20220529.0937)

After that, you can create dot files (you can find a tutorial for that) and run them at the command line.


Update

Here is a simple example of creating a graph after completing the installation:

I will choose a directory in which to work, to keep my work separate from the installation directory:

C:\Users\me\graphviz-work

In this directory I create the following text file called demo.dot. I create this file manually using Notepad++, and just type it all in:

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

In the same directory, at the command line, I run the following command to generate the graph from this file:

"C:\Program Files\Graphviz\bin\dot" -Tsvg demo.dot -o demo.svg

This generates the output file demo.svg:

enter image description here

This example is taken from the dot user's manual.


Everything I have shown here involves working at the command line (and editing text files by hand), and using the various Graphviz tools directly. As you have seen, you don't have to do this. You can use a tool such as Visual Studio to make things more convenient; you can use languages such as Python which allow you to build graphs programmatically (without you needing to directly interact with GraphViz).

So, there are various different ways to use GraphViz. Personally, I think it helps to understand the basics (as shown here) before using another tool.

3
  • Thanks, I did all these steps, but now my question is, when the Graphviz is installed, where I can see the graphs (I used Visual Studio code, but can I do it without VS)?
    – Pegi
    Commented Jun 25, 2022 at 17:21
  • 1
    Do you mean the source files, such as a .dot file? Or do you mean the output files, such as a .svg file, or whatever format you have chosen to create? The .dot files are just text files and can be created and edited in any decent text editor such as Notepad++. The output files are viewable using various image viewers, or even just by opening the file in a browser. Can you clarify your question? Commented Jun 25, 2022 at 17:29
  • Thank you so much; with your explanation and updated answer, my problem is solved now. I wanted to know how to generate a plot without using Visual studio or Python. Very helpful!
    – Pegi
    Commented Jun 26, 2022 at 5:36
0

I installed Visual Studio code, and by adding graphviz as extension, now I can write my code and get the graph I wanted!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.