Learn graph basics, draw networks in DrawFig, export TikZ for LaTeX, and follow layout and styling best practices.
Graph drawing primer — professional network diagrams from scratch
Published: 2026-03-06
Category: Tutorial
Tags: graph drawing, network diagrams, LaTeX, TikZ, research figures
Introduction
Graphs underpin CS, discrete math, and network science — social graphs, neural sketches, knowledge graphs, and algorithm visualisations all start from the same primitives.
This tutorial walks through
DrawFig for publication-quality graphs and
TikZ export for LaTeX papers.
1 — Graph basics
What is a graph?
- Vertices (nodes): entities
- Edges: relationships (line segments or curves)
- Directed graph: arrows show direction
- Undirected graph: symmetric ties
- Weights: numeric labels on edges (distance, cost, …)
Common families
- Simple graph — no loops, no multi-edges
- Complete graph — every pair adjacent
- Bipartite graph — two colour classes, edges only across
- Tree — connected, acyclic
- DAG — directed, acyclic
2 — Drawing in DrawFig
Step 1 — Open the editor
Visit
https://drawfig.com and launch the editor.
Step 2 — Add vertices
- Open the Graph / shape palette (product UI may label sections differently)
- Drag circular (or custom) vertices
- Duplicate (
Ctrl+D) and arrange
- Optional: run an auto-layout helper if available
Tips
- Multi-select with
Shift
- Use align / distribute tools
Step 3 — Add edges
- Pick the edge / connector tool
- Drag from one vertex to another
- Choose straight, orthogonal, curved, or directed variants
Tips
- Enable snapping so connectors meet vertex anchors
- Double-click an edge to add labels (e.g. weights)
- Right-click for stroke colour, width, dash patterns
Step 4 — Styling
- Vertices: colour by role, resize focal nodes, emphasise borders
- Edges: colour by relation type, thickness ∝ importance, arrowheads for direction
- Labels: math mode where appropriate (
$v_1$ style)
3 — Worked ideas
Idea A — Social tie diagram
Five people
A…E, undirected edges for “knows”, thickness for tie strength, colour clusters for communities.
Idea B — Shortest-path intuition
Vertices as graph nodes, directed weighted edges, colour to show visited frontier, arrows for relax order.
Idea C — Knowledge graph sketch
Rectangles for concepts, directed typed edges (“is-a”, “part-of”), layered layout for readability.
4 — Exporting TikZ
DrawFig can emit
TikZ you paste into LaTeX.
Export flow
- Finish the figure on canvas
- Menu: Export → TikZ (wording may vary slightly by build)
- Copy the generated code
Minimal LaTeX wrapper
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs, graphdrawing}
\usegdlibrary{force, trees}
\begin{document}
\section{Example graph}
\begin{tikzpicture}
\node (v1) at (0,0) {$v_1$};
\node (v2) at (2,0) {$v_2$};
\draw (v1) -- (v2);
\end{tikzpicture}
\end{document}
Tweaks after export
\node[draw, circle, fill=blue!20, minimum size=1cm] (v1) at (0,0) {$v_1$};
\draw[->, thick, red] (v1) -- node[above] {$w{=}5$} (v2);
5 — Best practices
Layout
- Minimise crossings, prefer symmetric skeletons
- Layer DAGs top-down
- Keep comfortable spacing between nodes
Colour
- Consistent palette per role
- Enough contrast; avoid relying on red–green alone
- Keep legend count small (≤5 swatches is a good target)
Labels
- Prefer proper math fonts for variables
- Keep text short; place labels outside crowded regions
Export targets
- Print / papers: PDF or SVG; ≥300 DPI for raster
- Slides: PNG/SVG
- LaTeX: TikZ whenever you need infinite zoom / journal compatibility
6 — FAQ
Q: Huge graphs (>50 vertices)?
A: Use auto-layout, draw in layers, or consider programmatic generation (NetworkX → TikZ).
Q: Weighted edges?
A: Label edges (
w=5), vary thickness or colour ramps.
Q: TikZ compile errors?
A: Load required TikZ libraries, test on TeX Live / Overleaf, consult DrawFig docs for dialect notes.
Q: Animation?
A: Not inside DrawFig itself — export frames or use LaTeX
animate, Matplotlib, etc.
7 — Power tips
Templates
Explore built-in tree, ring, grid, and layered starters when available.
Batch edits
Shift multi-select → move / restyle together;
Ctrl+G /
Ctrl+Shift+G for grouping.
Shortcuts (typical draw.io bindings)
Ctrl+D duplicate
Ctrl+Z undo
Delete remove selection
Interop
- LaTeX: TikZ export
- Python: JSON / graph interchange where supported
- Gephi: GEXF when exporters exist
- Slides: SVG/PNG
8 — Practice prompts
Beginner
1. Draw
K_5 (complete graph on 5 vertices)
2. Binary tree, depth 3
3. Small DAG with 6 vertices
Intermediate
1. 10-person social graph with tie strengths
2. Prerequisite graph for courses
3. Toy city grid network
Advanced
1. Compact neural-net block diagram
2. Domain mini knowledge graph
3. Multi-frame storyboard for an algorithm (export separate pages)
9 — Further reading
Books
- Introduction to Graph Theory — West
- Graph Theory with Applications — Bondy & Murty
- Discrete mathematics textbooks — graph chapters
TikZ
Tools
10 — Summary
You now have a checklist for:
- Core graph vocabulary
- Building diagrams in DrawFig
- Exporting TikZ for LaTeX
- Layout, colour, and label hygiene
- Common troubleshooting paths
Next actions
1. Reproduce one practice graph end-to-end
2. Export TikZ and compile a one-page TeX example
3. Drop the figure into a real paper or slide deck
Start drawing: https://drawfig.com
Related
- 📖
DrawFig vs FigDraw vs BioRender
- 📖
Network diagram guide
- 📖
User story — faster research team workflows
Questions? Comment on the article or email support@drawfig.com
Last updated: 2026-03-06 · DrawFig Team