Operations

This page outlines operations that can be done to BEL graphs.

pybel.struct.left_full_join(g, h)[source]

Add all nodes and edges from h to g, in-place for g.

Parameters

Example usage:

>>> import pybel
>>> g = pybel.from_bel_script('...')
>>> h = pybel.from_bel_script('...')
>>> left_full_join(g, h)
Return type

None

pybel.struct.left_outer_join(g, h)[source]

Only add components from the h that are touching g.

Algorithm:

  1. Identify all weakly connected components in h

  2. Add those that have an intersection with the g

Parameters

Example usage:

>>> import pybel
>>> g = pybel.from_bel_script('...')
>>> h = pybel.from_bel_script('...')
>>> left_outer_join(g, h)
Return type

None

pybel.struct.union(graphs, use_tqdm=False)[source]

Take the union over a collection of graphs into a new graph.

Assumes iterator is longer than 2, but not infinite.

Parameters
  • graphs (iter[BELGraph]) – An iterator over BEL graphs. Can’t be infinite.

  • use_tqdm (bool) – Should a progress bar be displayed?

Returns

A merged graph

Return type

BELGraph

Example usage:

>>> import pybel
>>> g = pybel.from_bel_script('...')
>>> h = pybel.from_bel_script('...')
>>> k = pybel.from_bel_script('...')
>>> merged = union([g, h, k])