# Network Analysis

This notebook runs network analysis of the table specified by the  *`input_table`* parameter.

### Assumed Input

For *input_table* , this notebook assumes a transition matrix that consists of `source, target, and weight/count` columns.` A sample table:`

| source | target | weight/count |
|  --- | --- | --- |
| google.com | /learn | 10 |
| google.com | / | 7.354033 |
| NULL | / | 5.698033 |
| /about | /about | 4.249822 |
| NULL | /press_release_jp | 4.034131 |


### Expected Outputs

This notebook outputs visualization of transitions. Supported network visualization methods:

* Directed Graph Visualization using [networkx](https://networkx.org/). Graph nodes are weighted and connected based on [PageRank](https://en.wikipedia.org/wiki/PageRank).
* Sankey Diagram Visualization using [Plotly](https://plotly.com/python/sankey-diagram/).


Some sample network analysis visualizations are as follows:
![](/assets/image2023-2-28_11-52-41.c112eacfe6a8ab6e2d36f438c0f55f1891312ca55bfcf43917793f54844d33dc.3cb60505.png)
![](/assets/image2023-2-28_11-53-33.7be074b8b23c83fee9726bcfde0300f6e480090ea2ab700524003b3e2647e0ff.3cb60505.png)

### Workflow Example

Find a sample workflow here in [Treasure Boxes](https://github.com/treasure-data/treasure-boxes/blob/automl/machine-learning-box/automl/network_analysis.dig).


```yaml
+network_analysis:
  ipynb>:
    notebook: network_analysis
    input_table: ml_datasets.transition_matrix
```

### Parameters

| Parameter Name | Parameter on Console | Description | Default Value |
|  --- | --- | --- | --- |
| docker.task_name | Docker Task Mem | Task memory size. Available values are 64g, 128g (default), 256g, 384g, or 512g depending on your contracted tiers. | 128g |
| input_table | Input Table | Specify a TD table used for analysis as *dbname.table_name.* | - |
| limit | Limit | Maximum number of edges to search. | 1000 |