Drawing Graphs

How to add graphs to this wiki.

1. Drawing revision graphs

The Mercurial wiki allows easily adding graph diagrams to pages. To draw a graph like this:

add a section like this:

{ { {#!dot
    digraph G {
      node [shape=box]
      a -> b -> c -> d -> e
} } }

For consistency, use [shape=box] for Mercurial revisions, [shape=ellipse] for the working directory, and rankdir=LR (left-to-right) or rankdir=BT (bottom-to-top) for revision graphs.

2. Drawing flowcharts

To draw a flowchart like this:


{ { {#!dot
digraph G {
  {node[shape=box] push pull merge}
  {node[shape=diamond] succeed}

  push [label="try to push"]
  succeed [label="did push succeed?"]
  pull [label="pull unsynced changes"]
  merge [label="merge"]

  start -> push -> succeed
  pull -> merge -> push:n
  succeed:e -> pull [label=n]
  succeed:s -> done [label=y]
} } }

Note the use of compass points to control edge start and end points.

3. See also


DrawingGraphs (last edited 2015-10-20 14:56:52 by Rain)