bokeh.models.graphs

class EdgesAndLinkedNodes(**kwargs)[source]

Bases: bokeh.models.graphs.GraphHitTestPolicy

With the NodesAndLinkedEdges policy, inspection or selection of graph edges will result in the inspection or selection of the edge and of the linked graph nodes. There is no direct selection or inspection of graph nodes.

JSON Prototype
{
  "id": "5d6a11b1-4ffc-49ce-9101-5267a1a0b65d",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class GraphHitTestPolicy(**kwargs)[source]

Bases: bokeh.model.Model

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

JSON Prototype
{
  "id": "adcebf94-c371-4d68-9663-4a8053eb46bf",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class LayoutProvider(**kwargs)[source]

Bases: bokeh.model.Model

Note

This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

JSON Prototype
{
  "id": "8e8e8239-08d8-478e-a983-a25a0dbc284b",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class NodesAndLinkedEdges(**kwargs)[source]

Bases: bokeh.models.graphs.GraphHitTestPolicy

With the NodesAndLinkedEdges policy, inspection or selection of graph nodes will result in the inspection or selection of the node and of the linked graph edges. There is no direct selection or inspection of graph edges.

JSON Prototype
{
  "id": "3b6febf3-9e2d-4606-9245-87d1d5480ffb",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class NodesOnly(**kwargs)[source]

Bases: bokeh.models.graphs.GraphHitTestPolicy

With the NodesOnly policy, only graph nodes are able to be selected and inspected. There is no selection or inspection of graph edges.

JSON Prototype
{
  "id": "fde1f768-59e4-400f-a659-8bfdd41930fd",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
class StaticLayoutProvider(**kwargs)[source]

Bases: bokeh.models.graphs.LayoutProvider

graph_layout

property type: Dict ( Either ( String , Int ), Seq ( Any ) )

The coordinates of the graph nodes in cartesian space. The dictionary keys correspond to a node index and the values are a two element sequence containing the x and y coordinates of the node.

{
    0 : [0.5, 0.5],
    1 : [1.0, 0.86],
    2 : [0.86, 1],
}
JSON Prototype
{
  "graph_layout": {},
  "id": "cb117cd3-b268-431d-ba36-5b66845ac2fa",
  "js_event_callbacks": {},
  "js_property_callbacks": {},
  "name": null,
  "subscribed_events": [],
  "tags": []
}
from_networkx(graph, layout_function, **kwargs)[source]

Generate a GraphRenderer from a networkx.Graph object and networkx layout function. Any keyword arguments will be passed to the layout function.

Parameters:
  • graph (networkx.Graph) – a networkx graph to render
  • layout_function (function) – a networkx layout function
Returns:

instance (GraphRenderer)

Warning

Only two dimensional layouts are currently supported.