# `ragraph.analysis.bus`#

Bus detection algorithms find bus nodes in graphs, also called “hubs” or “integrative components”. Typical bus nodes have a high node degree or “centrality” score.

All bus detection algorithms have the following arguments:

• `graph`: Graph to find bus nodes in.

• `root`: Root node to perform bus detection in.

• `leafs`: Optional list of leaf nodes to consider during the bus detection cycle. If not supplied, the leaf node descendants of the root will be considered.

They always return two lists of nodes:

• Leaf nodes that have been marked as bus nodes

• The remaining leaf nodes.

They currently do NOT change anything in the graph in-place. That is up to the user.

### Available algorithms#

The following algorithms are directly available after importing `ragraph.analysis.bus`:

• `gamma()`: Gamma bus detection.

## Package Contents#

### Functions#

 `gamma`(→ Union[Tuple[List[ragraph.graph.Node], ...) Detect bus nodes in an adjacency matrix.
ragraph.analysis.bus.gamma(graph: ragraph.graph.Graph, root: Optional[Union[ragraph.graph.Node, str]] = None, leafs: Optional[Union[List[ragraph.graph.Node], List[str]]] = None, inherit: bool = True, loops: bool = False, edge_weights: Optional[List[str]] = None, names: bool = False, gamma: float = gamma_params['gamma'].default, safe: bool = True, **kwargs) Union[Tuple[List[ragraph.graph.Node], List[ragraph.graph.Node]], Tuple[List[str], List[str]]]#

Detect bus nodes in an adjacency matrix.

Parameters:
• matrix – Adjacency matrix.

• root – Root node of this bus detection analysis.

• leafs – Optional list of nodes to consider leafs during this bus detection cycle.

• inherit – Whether edges between descendants of nodes should be taken into account (if applicable).

• loops – Whether self-loop edges should be taken into account (if applicable).

• gamma – Bus threshold w.r.t. median of nonzero node degrees.

• names – Whether to return node names or node instances.

Returns:

Bus leafs. Nonbus leafs.

Note

Works by selecting node degree outliers by some factor gamma w.r.t. median of nonzero node degrees.