VisJS network interface#

VisJS offers nice graph displays.

gismap.gisgraphs.builder.make_vis(lab, **kwargs)[source]#

Generate HTML visualization of a lab’s collaboration network.

Parameters:
  • lab (LabMap) – Lab to display.

  • uid (str, optional) – Unique identifier for DOM elements. Auto-generated if not provided.

  • vis_url (str, optional) – URL to vis-network library.

  • groups (dict, optional) – Group styling configuration.

  • draw_legend (bool, optional) – Whether to draw the legend. Defaults to True if multiple groups.

  • physics (dict, optional) – Physics engine configuration.

  • nodes_options (dict, optional) – Node styling options.

  • edges_options (dict, optional) – Edge styling options.

  • interaction_options (dict, optional) – Interaction settings.

  • style (string.Template, optional) – CSS template.

  • script (string.Template, optional) – JavaScript template.

  • inline_images (bool, default=True) – If True, fetch each node image and embed it as a data: URI so the canvas stays clean and PNG export works. Images that fail to download or exceed max_inline_bytes are demoted to the initials fallback (no external URL is ever left on a node).

  • max_inline_bytes (int, default=200_000) – Skip inlining for any image larger than this (e.g. uncropped LDAP portraits). The node is demoted to initials.

Returns:

HTML code as a string.

Return type:

str

gismap.gisgraphs.graph.initials(name)[source]#
Parameters:

name (str) – Person’s name.

Returns:

Person’s initials (2 letters only).

Return type:

str

gismap.gisgraphs.graph.lab_to_graph(lab)[source]#
Parameters:

lab (LabMap) – A lab populated with authors and publications.

Returns:

(nodes, edges, publications) where nodes and edges carry only display data plus pub_keys references, and publications is a dict keyed by publication key with the full per-pub payload (title, authors, venue, year, url, abstract, bib). Modal HTML is built JS-side from this shared dict, so each publication is shipped only once even when it touches many authors and pairs.

Return type:

tuple

Examples

>>> from gismap.lab import ListMap as Map
>>> lab = Map(author_list=['Tixeuil Sébastien', 'Mathieu Fabien'], name='mini', dbs="hal")
>>> lab.update_authors()
>>> lab.update_publis()
>>> len(lab.authors)
2
>>> 320 < len(lab.publications) < 430
True
>>> nodes, edges, pubs = lab_to_graph(lab)
>>> nodes[0]['group']
'mini'
>>> edges[0]['hover']
'Show joint publications from Mathieu Fabien and Tixeuil Sébastien'
>>> sample = next(iter(pubs.values()))
>>> {'title', 'authors', 'bib'} <= set(sample)
True
>>> html = lab.html(groups={"mini": {"color": "#777"}})
gismap.gisgraphs.graph.to_edge(k, pub_keys, searchers)[source]#
Parameters:
  • k (tuple) – Keys of the two authors.

  • pub_keys (list) – Joint publication keys, year-desc order.

  • searchers (dict) – Authors keyed by author key.

Returns:

Display-ready data for the collaboration edge.

Return type:

dict

gismap.gisgraphs.graph.to_node(s, pub_keys)[source]#
Parameters:
  • s (LabAuthor) – Author.

  • pub_keys (list) – Publication keys associated with this author, year-desc order.

Returns:

Display-ready data for the node. Modal HTML is rendered on click by the JS layer using pub_keys and the shared publications dict.

Return type:

dict

class gismap.gisgraphs.widget.GismapWidget[source]#

A simple widget to test the production of LabMaps and EgoMaps.

Examples

This is a doctest example. Use a notebook to play with the widget.

>>> gw = GismapWidget()  
VBox(children=(HTML(value=''), Output(), HBox(children=(Textarea(value='', ...
>>> gw.names.value = "Fabien Mathieu"
>>> gw.dbs.value = "HAL"
>>> gw.size.value = 3
>>> gw.compute_function(gw.compute, show=False)
>>> gw.save_link.value[:30]
"<a href='data:text/html;base64"
>>> gw.names.value = "Diego Perino, Laurent Viennot"
>>> gw.compute_function(gw.compute, show=False)
>>> gw.save_link.value[:30]
"<a href='data:text/html;base64"
compute_function(b, show=True)[source]#

Handle compute button click and generate visualization.

Parameters:
  • b (ipywidgets.Button) – The button widget that triggered this callback.

  • show (bool, default=True) – Whether to display the result in the widget.

Return type:

None

html()[source]#

Generate the HTML visualization based on widget inputs.

Returns:

HTML content for the collaboration graph.

Return type:

str

gismap.gisgraphs.widget.safe_filename(name)[source]#
Parameters:

name (str) – Pretty much anything.

Returns:

GisMap filename.

Return type:

str