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('matplotlib')
hv.output(fig='svg')
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#
fb_graph.opts(
cmap='tab20', node_color='circle', fig_size=350,
show_frame=False, xaxis=None, yaxis=None, node_size=10)
TypeError: '<' not supported between instances of 'str' and 'float'
Traceback (most recent call last):
File "/Users/runner/work/holoviews/holoviews/.pixi/envs/docs/lib/python3.11/site-packages/numpy/_core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'float'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/runner/work/holoviews/holoviews/holoviews/plotting/mpl/graphs.py", line 120, in get_data
style = self._apply_transforms(element, ranges, style)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/holoviews/holoviews/holoviews/plotting/mpl/element.py", line 674, in _apply_transforms
val = util.search_indices(val, factors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/holoviews/holoviews/holoviews/core/util/__init__.py", line 2256, in search_indices
return orig_indices[np.searchsorted(source[orig_indices], values)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/holoviews/holoviews/.pixi/envs/docs/lib/python3.11/site-packages/numpy/_core/fromnumeric.py", line 1527, in searchsorted
return _wrapfunc(a, 'searchsorted', v, side=side, sorter=sorter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/holoviews/holoviews/.pixi/envs/docs/lib/python3.11/site-packages/numpy/_core/fromnumeric.py", line 66, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/holoviews/holoviews/.pixi/envs/docs/lib/python3.11/site-packages/numpy/_core/fromnumeric.py", line 46, in _wrapit
result = getattr(arr, method)(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'float'
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).