Using Graphviz Paint

Source: Internet
Author: User

We use the dot language to draw graph (the graph ^^ in the algorithm).

1. Non-direction diagram

In the dot language, for the non-graph, use the name of the graph followed by the keyword graph. For edges such as u-> V, the dot language is expressed as "U-V".

Here's an example:

$ cat UNDIRECTED.GV 
graph undirected {
 1--2;
 3--2;
 4--1;
 2--5--4;
}

The command to generate the picture is as follows:

Dot-tpng UNDIRECTED.GV > Undirected.png
The resulting picture is as follows:

You can also use the Neato command.

Neato-tpng UNDIRECTED.GV > Undirected.png
You can also use a different format:

Neato-teps UNDIRECTED.GV > Undirected.eps

2 direction diagram

In the dot language, use-> instead of "--". Use the digraph keyword.

Here's an example:

Digraph directed {
    a-> b;
    A-> c-> d [color=red,penwidth=3.0];
    C-> e;
}

The resulting picture is as follows:



When using Graphviz, it is sometimes reported that "Format:" PNG "not recognized" error. can use

Dot-c

Resolve (requires root permission).

Reference:

Http://www.eecs.berkeley.edu/Pubs/TechRpts/2013/EECS-2013-176.pdf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.