edgegraph.output.pyvis.make_pyvis_net

Contents

edgegraph.output.pyvis.make_pyvis_net#

edgegraph.output.pyvis.make_pyvis_net(uni, rvfunc=None, refunc=None)#

Convert a given Universe to a PyVis network, suitable for further use within PyVis.

This function accepts a Universe object to a pyvis.network.Network object. The Network object will have all the nodes (edgegraph calls them “vertices”, pyvis calls them “nodes”, same abstract thing) from the given Universe, and all the edges between them. Directionality of the edges assigned to the Network reflects their directionality in the Universe.

See also

pyvis_render_customizable(), which provides the same features as this function, but sets up a customization UI as well.

Parameters:
  • uni (Universe) – The universe to use as input.

  • rvfunc (Callable) – A callable object to provide the label for any given vertex being added to the network (short for “(R)ender (V)ertex (Func)tion”). If supplied, it must take one argument (an instance of Vertex or subclass thereof), and must return a str. If not provided, hex(id(vert)) will be used.

  • refunc (Callable) – A callable object to provide the label for any given edge being added to the network (short for “(R)ender (E)dge (Func)tion”). If supplied, it must take one argument (an instance of TwoEndedLink, or subclass thereof), and must return a str. If not provided, edges will not be labelled.

Returns:

A pyvis.network.Network instance containing the data found in the given universe.

Return type:

pyvis.network.Network