# Nodes, edges and groups

The shapes a node can take, edges and their line styles, and groups, with the editor command and the line of text for each.

A flowchart is made of three things:

- **Nodes**: the steps, decisions and records, each drawn as a shape.
- **Edges**: the lines between nodes.
- **Groups**: boxes that hold related nodes.

## Node shapes

Each node has a shape. These are the ones most diagrams use:

![Six shapes, each labelled with its name: Stadium, Rectangle, Diamond, Hexagon, Cylinder and Document.](/images/docs/diagrams/common-shapes.svg)

| Shape     | Usually means      | Text                              |
| --------- | ------------------ | --------------------------------- |
| Stadium   | A start or an end  | `start(["Claim received"])`       |
| Rectangle | A step             | `check["Check receipts"]`         |
| Diamond   | A decision         | `limit{"Over £500?"}`             |
| Hexagon   | A preparation step | `prep{{"Prepare the batch"}}`     |
| Cylinder  | A database         | `ledger[("Ledger")]`              |
| Document  | A document         | `policy["Policy"]@{ shape: doc }` |

The word before the brackets is the node's id: a short name that edges use to point to the node. It doesn't show in the diagram. The text in quotes is its label, which shows on the node.

With Line9 Pro, in the [Line9 editor](/docs/how-the-editor-works), type `:shape` and choose from every shape, with a picture of each. The [editor reference](/docs/editor#shapes-and-line-styles) lists them all.

## Edges and line styles

An edge joins two nodes by their ids.

![Claim submitted joins Check receipts with a solid line labelled Solid. Check receipts joins Spot-check by Audit with a dotted line labelled Dotted.](/images/docs/diagrams/line-styles.svg)

| Line   | Text               |
| ------ | ------------------ |
| Solid  | `claim --> check`  |
| Dotted | `check -.-> audit` |
| Thick  | `claim ==> check`  |

To label an edge, put the label between bars:

```mermaid
claim -->|"Solid"| check
```

With Line9 Pro, in the Line9 editor, press `>` and move to the other node to connect two nodes, and type `:line` to change the line.

## Groups

A group draws a box around related nodes, with a title. Use groups for teams, systems or stages.

![Two groups side by side: Employee holds Submit claim and Attach receipts; Finance holds Within policy? and Pay claim.](/images/docs/diagrams/groups.svg)

```mermaid
flowchart LR
  subgraph finance["Finance"]
    policy{"Within policy?"}
    pay["Pay claim"]
  end
```

A group can sit inside another group. Each node belongs to one group at most.

With Line9 Pro, in the Line9 editor, select the nodes and type `:group` and the title of an existing group, or a new title.

## Colours and the legend

To colour nodes, edges or groups by role, give them a class. Line9 picks the colours and explains them in a legend. See [Colour-code with classes](/docs/classes).

## Next

- [Comments and text blocks](/docs/comments-and-text-blocks): add notes beside the diagram.
- [Colour-code with classes](/docs/classes): colour nodes by role.
