Network Graph#

Download this notebook from GitHub (right-click to download).


The data in this example represents Facebook social circle obtained from SNAP.

Most examples work across multiple plotting backends, this example is also available for:

import pandas as pd
import holoviews as hv
hv.extension('bokeh')

Declaring data#

edges_df = pd.read_csv('../../../assets/fb_edges.csv')
nodes_df = pd.read_csv('../../../assets/fb_nodes.csv')

fb_nodes = hv.Nodes(nodes_df).sort()
fb_graph = hv.Graph((edges_df, fb_nodes), label='Facebook Circles')

Plot#

colors = ['#000000']+hv.Cycle('Category20').values
fb_graph = fb_graph.redim.range(x=(-0.05, 1.05), 
                                y=(-0.05, 1.05)
                               )
fb_graph.opts(color_index='circle', width=800, height=800, show_frame=False,
                 xaxis=None, yaxis=None,node_size=10, edge_line_width=1, cmap=colors)
WARNING:param.GraphPlot: The `color_index` parameter is deprecated in favor of color style mapping, e.g. `color=dim('color')` or `line_color=dim('color')`
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.

Download this notebook from GitHub (right-click to download).