> For the complete documentation index, see [llms.txt](https://vikram-bajaj.gitbook.io/cs-gy-6313-information-visualization/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vikram-bajaj.gitbook.io/cs-gy-6313-information-visualization/networks-and-trees/visualizing-network-data/node-link-diagrams.md).

# Node-Link Diagrams

Node-Link diagrams use **nodes** (points/symbols) to denote objects and **links/edges** (lines) to represent relationships.

## Force-Directed Layout

Nodes are arranged according to the **attraction** and **repulsion** forces between the nodes.

The main **goal** is to visualize the *structure* of the network.

### Steps

1. Nodes are first initialized in random positions
2. For each node, the sum of the forces acting on the node are calculated; this value gives the direction and intensity for moving the node
3. Nodes are moved accordingly
4. 2 and 3 are repeated iteratively until a stable positioning is found

![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VM3w0hXsavKwkAH%2Fforce-directed.png?generation=1586990834757142\&alt=media)

Various attributes can be encoded in nodes and links:

* **Color** and **Shape** can be used to encode categorical information in the nodes
* **Size** can be used to encode quantitative attributes in the nodes
* **Edge Thickness** can be used to encode quantitative information in the links/edges
* **Patterns** can be used to encode categorical information in the links/edges
* **Color** and **Arrows** can be used to encode direction of the edges

## Fixed Layout

In a fixed layout, the positions of the nodes remain fixed from the beginning, according to certain criteria.

There are 3 types of fixed layouts:

* **Circular** (shown below)
  * Nodes are arranged in a circular fashion, and are equidistant
  * This is the most common fixed layout
* **Linear**

  Nodes are arranged along a line, and are equidistant
* **Grid**

  Nodes are arranged in a grid

![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VM5TlZj-iAHAisa%2Ffixed-circular.png?generation=1586990826580682\&alt=media)

### Why Use a Fixed Layout?

The Force-Directed Layout, as discussed earlier, is used when the structure of the network is to be visualized. The Fixed layout is used because of the following reasons:

* **Visibility**
  * Since the nodes are arranged at fixed positions, they are always visible. So are the links
  * This also means that the properties of the nodes and links are clearly visible
  * This is not the case in force-directed layouts, where some nodes may be more visible than others
  * A fixed layout also makes it easier to spot large and small nodes and to determine which nodes are well-connected or poorly-connected to other nodes (degree)
* **Grouping into Categories**
  * A fixed layout allows the grouping of nodes into meaningful/useful categories
  * This allows us to visualize not just the connections between nodes, but also the relationships between different categories

    ![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VMNvj2FUaBG_aJu%2Fgrouping.png?generation=1586990826527806\&alt=media)

### Edge Bundling

When we have too many edges that cross over each other and create clutter, we use the concept of **edge bundling**. This refers to the bundling together of edges that flow in a similar direction, with the hope of reducing clutter and being able to clearly represent the properties of the edges.

![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VMPlzP6MQnJEEex%2Fedge_bundling.png?generation=1586990826632434\&alt=media)

Instead of connecting nodes using a straight line, the line follows a path that is designed by some structure that connects the nodes together. This is denoted using a **spline** curve.

![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VMRNUwKHhwrr0kM%2Fedge_bundling_steps.png?generation=1586990826907555\&alt=media)The points used to create the spline are called **control points**.

### Spatial Fixed Layout

This is used when the fixed layout is actually a map, or some other representation of space. The nodes represent fixed spatial locations.

A typical example is a **migration map**.

![](https://612062878-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VMT1F0twQlVRB5B%2Fspatial%20fixed%20layout.png?generation=1586990832603328\&alt=media)
