Home » Latex Node Graphs using Tikz

Latex Node Graphs using Tikz

by Online Tutorials Library

Latex Node Graphs using Tikz

The node graphs can be drawn with the use of the tikz environment as well.

You can draw the circles around the vertices or can use them directly. The commands used for styles are different from those in block diagrams or flow charts. The command to draw vertex is named by node, and the command to draw an edge is named by the edge.

The commands used in the Latex are mostly derived from the common words, which can be easily understand and implement within the code.

Before beginning the shapes, you need to mention some environments. You must include your text and command within these environments only, which are given below:

With the use of points on the x-axis and y-axis, you can draw any shape. The common shapes used in the Latex using Tikz are given below:

  • Circle

The command used to draw a circle is draw (1,1) circle (1);

Here, (1, 1) are the point on x and y-axis, while the (1) is the radius of the circle.

The output of the above circle will look like the image given below:

Latex Node Graphs using Tikz

  • Triangle

The command used to draw a triangle is given below:

Output:

Latex Node Graphs using Tikz

You can change the position of points of the x and y-axis according to the requirements.

You can also fill the color inside the triangle by using the command given below:

Output:

Latex Node Graphs using Tikz

To increase the width of the triangle, you can use the command given below:

Output:

Latex Node Graphs using Tikz

You can also draw the color pattern inside the triangle by using the command given below:

Output:

Latex Node Graphs using Tikz

You can also use any shape instead of the triangle.

  • Ellipse

To draw the ellipse, you need to use the below command:

Here, (0, 0) is the point at the origin, and 30pt and 22pt are the dimensions to draw the ellipse.

Output:

Latex Node Graphs using Tikz

You can also mix two colors accordingly.

The command for such example is written as:

Output:

Latex Node Graphs using Tikz

Using such methods, you can create any shape according to your choice.

Let-s begin with the node graph.

The code to create a simple node graph is given below:

Output:

Latex Node Graphs using Tikz

You can also bend the edges of your diagram with a certain angle.

The code to create a node graph with bend edges is given below:

Output:

Latex Node Graphs using Tikz


You may also like