Network graph

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:

In [1]:
import pandas as pd
import holoviews as hv
hv.extension('matplotlib')

%output fig='svg'

Declaring data

In [2]:
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

In [3]:
plot_opts = dict(color_index='circle', fig_size=350, xaxis=None, yaxis=None, show_frame=False)
style_opts = dict(node_size=10, cmap='tab20')
fb_graph = fb_graph.redim.range(x=(-0.05, 1.05), y=(-0.05, 1.05)).opts(style=style_opts, plot=plot_opts)
fb_graph
Out[3]:

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