# Graph Plotting

Graph Plotting is used to visualize the network topology of a graph

This is a part of a series of custom modules based on the CRAN [igraph][1] package.
Graph Plotting is used to visualize the network topology of a graph.
The left input port is the graph dataset and needs to be represented in two columns as a list of edges where each value in each column represents a Node Id and each row represents an Edge, as shown here. The column names are not relevant.
![img1][i1]
The second input port from the left is optional and represents node labels. If this port is not used, labels are assumed to be the node IDs given by the graph dataset as shown above. If used, input data needs to be a single column dataset as shown here. The column name is not relevant.
![img2][i2]
The third input port from the left is optional and represents node weights. When used, node sizes in the plot are proportional to those weights. In this case, input data needs to be a single column dataset as shown here. The column name is not relevant.
![img3][i3]
The fourth input port from the left is optional and represents edge weights. When used, edge sizes in the plot are proportional to those weights. In this case, input data needs to be a single column dataset as shown here. The column name is not relevant.
![img4][i4]
The fifth input port from the left is optional and represents node community membership. When used, nodes in the plot are colored per their community membership. In this case, input data needs to be a single column dataset as shown here. The column name is not relevant.
![img5][i5]
Here are some examples showing how to use this custom component.
![img6][i6]
In this first simple example above, network.csv was generated using available code as described in “Lancichinetti, Andrea, Santo Fortunato, and Filippo Radicchi: Benchmark graphs for testing community detection algorithms. Physical Review E 78.4 (2008): 046110”.
This is what the output of the module looks like for this graph. Here the plot was generated for the complete graph, using the automatic layout, no labels, and minimum node size.
![img7][i7]
![img8][i8]
This second example above is similar to the first one, but here we have the community membership information, which is used to color each node according to its community membership.
This is what the output of the module looks like for this graph. Here the plot was generated for the complete graph, using the automatic layout, no labels, and node size 10.
![img9][i9]
![img10][i10]
In this third example above, power_grid.csv represents an undirected, unweighted network representing the topology of the Western States Power Grid of the United States. It can be downloaded from the UCI Network Data Repository [here][2].
Here we also have the community information, but as we don’t have a ground-truth community membership, we computed them using the Graph Communities custom module.
This is what the output of the module looks like for this graph. Here the Plot Type property was set to Community Graph. In this way, instead of plotting the complete graph, as in the first and second examples, here each node represents a community. Node sizes are proportional to the number of nodes in each community and edge sizes are proportional to the amount of edges linking 2 communities. Each node has a different color, to represent a different community. We also use the circular layout, with labels.
![img11][i11]
For more information about the plotting layouts available in this module, please see the references below:
- [Automatic Layout][3]
- [Kamada-Kawai Layout][4]
- [Fruchterman-Reingold Layout][5]
- [Graphopt Layout][6]
- [Circular Layout][7]
- [Grid Layout][8]
[1]:http://igraph.org/r/
[2]:https://networkdata.ics.uci.edu/data.php?id=107
[3]:http://igraph.org/r/doc/layout_nicely.html
[4]:http://igraph.org/r/doc/layout_with_kk.html
[5]:http://igraph.org/r/doc/layout_with_fr.html
[6]:http://igraph.org/r/doc/layout_with_graphopt.html
[7]:http://igraph.org/r/doc/layout_in_circle.html
[8]:http://igraph.org/r/doc/layout_on_grid.html
[i1]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_1.PNG
[i2]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_2.PNG
[i3]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_3.PNG
[i4]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_4.PNG
[i5]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_5.PNG
[i6]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_6.PNG
[i7]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_7.PNG
[i8]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_8.PNG
[i9]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_9.PNG
[i10]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_10.PNG
[i11]:https://alvilcek.blob.core.windows.net/azuremlcustommodules/Azure%20ML%20Custom%20Modules/documentation/Graph_Plotting_11.PNG