Genetic algorithms for sequencing purposes.

Module Contents#


genetic(→ Tuple[ragraph.graph.Graph, ...)

genetic_sequencing(→ ratio_genetic_py.Lineage)

Genetic sequencing of nodes in a graph.




ragraph.analysis.sequence._genetic.genetic(graph: ragraph.graph.Graph, root: Optional[Union[str, ragraph.graph.Node]] = None, nodes: Optional[Union[List[str], List[ragraph.graph.Node]]] = None, evaluator: Optional[str] = params['evaluator'].default, n_chromosomes: Optional[int] = params['n_chromosomes'].default, n_generations: Optional[int] = params['n_generations'].default, p_crossover: Optional[float] = params['p_crossover'].default, p_mutation: Optional[float] = params['p_mutation'].default, p_swap: Optional[float] = params['p_swap'].default, inherit: bool = True, edge_weights: Optional[List[str]] = None, loops: bool = False, inplace: bool = True, names: bool = False, safe: bool = True, **kwargs) Tuple[ragraph.graph.Graph, List[ragraph.graph.Node]]#
ragraph.analysis.sequence._genetic.genetic_sequencing(graph: ragraph.graph.Graph, nodes: List[ragraph.graph.Node], n_chromosomes: int, n_generations: int, n_hall_of_fame: int, p_crossover: float, p_mutation: float, p_swap: float, evaluator: str = 'feedback_distance', n_records: Optional[int] = None, inherit: bool = True, edge_weights: Optional[List[str]] = None) ratio_genetic_py.Lineage#

Genetic sequencing of nodes in a graph.

  • graph – Graph holding data.

  • nodes – Nodes to sequence.

  • evaluator – Evaluation method to use. One of “feedback_distance”, “feedback_marks”, or “lower_left_distance”.

  • n_chromosomes – Number of chromosomes in each generation.

  • n_generations – Number of generations to simulate.

  • n_hall_of_fame – Hall of Fame size of best performing chromosomes.

  • p_crossover – Probability for a pair to be subjected to crossover.

  • p_mutation – Probability for each chromosome to be subjected to mutation.

  • p_swap – Probability for each gene to be swapped with another during mutation.

  • n_records – Number of generation records to keep.

  • inherit – Whether to inherit edges between children when getting the adjacency matrix.

  • edge_weights – Edge weights to consider when getting the adjacency matrix.


Lineage object containing generations of chromosomes, generation records and a hall of fame of best performing chromosomes.