# `ragraph.analysis.sequence`#

Sequencing algorithms search for sequences of nodes according to some objective or logic. Simple are sorting by name and more elaborate examples sort according to Markov transisition probabilities or sequences without feedback (edges to earlier nodes).

There are several metrics from literature available to grade sequences as well. The metrics are documented over at `metrics`.

Finally, there are some utilities like branch-sorting (recursively sorting all branches in a hierarchical tree instead of all leaf nodes as a whole) available in `utils`.

### Available algorithms#

The following algorithms are directly accessible after importing `ragraph.analysis.sequence`:

• `markov()`: Markov sequencing based on relative node dependency and influence.

• `name()`: Sequence nodes by node name.

• `tarjans_dfs()`: Sequence nodes according to Tarjan’s Depth First Search algorithm. Sequence a Directed Acyclic Graphs (DAG) into a sequence without feedback edges to earlier nodes.

## Package Contents#

### Functions#

 `axis`(graph[, root, nodes, kinds, sort_by_bus, ...]) `markov`(→ Tuple[ragraph.graph.Graph, ...) `name`(→ Tuple[ragraph.graph.Graph, ...) Sequence nodes by node name. `scc_tearing`(→ Tuple[ragraph.graph.Graph, ...) `tarjans_dfs`(→ Tuple[ragraph.graph.Graph, ...) `branchsort`(→ Tuple[ragraph.graph.Graph, ...)
ragraph.analysis.sequence.axis(graph: ragraph.graph.Graph, root: Optional[Union[str, ragraph.node.Node]] = None, nodes: Optional[Union[List[ragraph.node.Node], List[str]]] = None, kinds: Optional[List[str]] = None, sort_by_bus: bool = True, sort_by_width: bool = True, edge_weights: Optional[List[str]] = None, inherit: bool = True, loops: bool = False, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs)#
ragraph.analysis.sequence.markov(graph: ragraph.graph.Graph, root: Optional[Union[str, ragraph.graph.Node]] = None, nodes: Optional[Union[List[ragraph.graph.Node], List[str]]] = None, edge_weights: Optional[List[str]] = None, inf: float = markov_params['inf'].default, dep: float = markov_params['dep'].default, mu: float = markov_params['mu'].default, scale: bool = markov_params['scale'].default, inherit: bool = True, loops: bool = False, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs) Tuple[ragraph.graph.Graph, List[ragraph.graph.Node]]#
ragraph.analysis.sequence.name(graph: ragraph.graph.Graph, root: Optional[Union[str, ragraph.graph.Node]] = None, nodes: Optional[Union[List[str], List[ragraph.graph.Node]]] = None, inherit: bool = True, loops: bool = False, edge_weights: Optional[List[str]] = None, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs) Tuple[ragraph.graph.Graph, List[ragraph.graph.Node]]#

Sequence nodes by node name.

Parameters:
• graph – Graph to sequence nodes of.

• nodes – Nodes to sequence.

Returns:

Sequenced nodes.

ragraph.analysis.sequence.scc_tearing(graph: ragraph.graph.Graph, decision: Callable[[ragraph.graph.Graph, List[ragraph.node.Node]], ragraph.node.Node], decision_args: Optional[Dict[str, Any]] = None, root: Optional[Union[str, ragraph.node.Node]] = None, nodes: Optional[Union[List[ragraph.node.Node], List[str]]] = None, inherit: bool = True, loops: bool = False, edge_weights: Optional[List[str]] = None, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs) Tuple[ragraph.graph.Graph, List[ragraph.node.Node]]#
ragraph.analysis.sequence.tarjans_dfs(graph: ragraph.graph.Graph, root: Optional[Union[str, ragraph.node.Node]] = None, nodes: Optional[Union[List[str], List[ragraph.node.Node]]] = None, inherit: bool = True, loops: bool = False, edge_weights: Optional[List[str]] = None, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs) Tuple[ragraph.graph.Graph, List[ragraph.node.Node]]#
ragraph.analysis.sequence.branchsort(graph: ragraph.graph.Graph, algo: Callable, algo_args: Optional[Dict[str, Any]] = None, root: Optional[Union[str, ragraph.graph.Node]] = None, nodes: Optional[Union[List[ragraph.graph.Node], List[str]]] = None, leafs: Optional[Union[List[ragraph.graph.Node], List[str]]] = None, edge_weights: Optional[List[str]] = None, inherit: bool = True, loops: bool = False, inplace: bool = True, recurse: bool = True, names: bool = False, safe: bool = True) Tuple[ragraph.graph.Graph, List[ragraph.graph.Node], List[ragraph.graph.Node]]#