# Matrices

Matrices are another way to visualize network data.

This is done using an **adjacency matrix**.

The nodes are encoded using **rows** and **columns**, and the edges are encoded in the **cells**.

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

## Why Use Matrices?

* **Full visibility** of nodes and relationships, and corresponding properties
* **No line crossings** (so, no clutter)

  This gets rid of the **hairball effect** that is common in node-link diagrams, especially when every node is connected to every other node:

  ![](https://192301203-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VrrtCcyCuNCcWqT%2Fhairball%20effect.png?generation=1586990828867193\&alt=media)

## Drawbacks

* **Less familiarity** with the representation, since it isn't very common
* Feels **less natural** than using nodes and links
* **Less scalability** (cells become too small beyond 100-200 nodes)
* **Needs reordering** in order to show structures or patterns

  ![](https://github.com/vikrambajaj22/cs-gy-6313-information-visualization/tree/3c48b78fa6863e413bc5de9fbb02bc202da645ff/assets/reordering.png)**Left**: without sorting the data, **Right**: after sorting the data

### Note

For undirected networks, matrices are symmetric. However, for directed networks, the cells can be filled according to the edge directions.

A **parallel axes** representation is a common substitute for matrices, when direction is to be shown:\
![](https://192301203-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5-0RG_uqhxyMNjpMUW%2F-M5-0SvQ45Rarxg8L2lA%2F-M5-0VryVTpRMa9GFDa1%2Fparallel.png?generation=1586990828774174\&alt=media)
