New comer question, what is the appropriate input format?

Hi,
I am new to graphviz and maybe the question looks simple. I have a text file which looks like

1
1
2
3
2

That means:
1->1
1->2
2->3
3->2

My question is how can I use graphviz to visualize the data? Should I create a two column text file like this:

1 1
1 2
2 3
3 2

or something else?
Please share your thoughts.

I suggest reading some (or all) of this document: https://www.graphviz.org/pdf/dotguide.pdf. If nothing else, look at the example on page 3.

1 Like

Here’s one way to do it using the dot engine:

[dot verbose=true]

digraph {
    1->1
    1->2
    2->3
    3->2
}

[/dot]

Command to run:

dot -T png mygraph.dot -o mygraph.png

Using the fdp engine
[dot verbose=true engine=fdp]

digraph {
    1->1
    1->2
    2->3
    3->2
}

[/dot]

Command to run:

dot -T png mygraph.dot -K fdp -o mygraph.png

Undirected graph with the fdp engine:

[dot verbose=true engine=fdp]

graph {
    1--1
    1--2
    2--3
    3--2
}

[/dot]

1 Like

Yes thank you very much.

1 Like