hydra.topology module
A model for simple graphs as adjacency lists.
- class hydra.topology.OrderingIsomorphism(encode: Annotated[Callable[[Sequence[A]], Sequence[A]], 'Mapping from source ordering to target ordering'], decode: Annotated[Callable[[Sequence[A]], Sequence[A]], 'Mapping from target ordering to source ordering'])
Bases:
Generic[A]A pair of inverse permutations on lists, used to relate two orderings of the same elements.
- class Builder(_encode: 'Callable[[Sequence[A]], Sequence[A]]' = None, _decode: 'Callable[[Sequence[A]], Sequence[A]]' = None)
Bases:
Generic[A]- build()
- decode(decode)
- encode(encode)
- DECODE = Name(value='decode')
- ENCODE = Name(value='encode')
- TYPE_ = Name(value='hydra.topology.OrderingIsomorphism')
- static builder()
- decode: Annotated[Callable[[Sequence[A]], Sequence[A]], 'Mapping from target ordering to source ordering']
- encode: Annotated[Callable[[Sequence[A]], Sequence[A]], 'Mapping from source ordering to target ordering']
- with_decode(decode)
- with_encode(encode)
- class hydra.topology.TarjanState(counter: Annotated[int, 'Next available index for vertices in the DFS traversal'], indices: Annotated[Mapping[int, int], 'Mapping from vertices to their indices in the DFS traversal'], low_links: Annotated[Mapping[int, int], 'Mapping from vertices to their lowest reachable index in the DFS traversal'], stack: Annotated[Sequence[int], 'Current DFS stack, with vertices in reverse order'], on_stack: Annotated[Set[int], 'Set of vertices currently on the stack, for quick lookup'], sccs: Annotated[Sequence[Sequence[int]], 'Accumulated strongly connected components, each a list of vertices'])
Bases:
objectState carried by Tarjan’s strongly connected components algorithm during a depth-first traversal.
- class Builder(_counter: 'int' = None, _indices: 'Mapping[Vertex, int]' = None, _low_links: 'Mapping[Vertex, int]' = None, _stack: 'Sequence[Vertex]' = None, _on_stack: 'Set[Vertex]' = None, _sccs: 'Sequence[Sequence[Vertex]]' = None)
Bases:
object- build()
- counter(counter)
- indices(indices)
- low_links(low_links)
- on_stack(on_stack)
- sccs(sccs)
- stack(stack)
- COUNTER = Name(value='counter')
- INDICES = Name(value='indices')
- LOW_LINKS = Name(value='lowLinks')
- ON_STACK = Name(value='onStack')
- SCCS = Name(value='sccs')
- STACK = Name(value='stack')
- TYPE_ = Name(value='hydra.topology.TarjanState')
- static builder()
- counter: Annotated[int, 'Next available index for vertices in the DFS traversal']
- indices: Annotated[Mapping[int, int], 'Mapping from vertices to their indices in the DFS traversal']
- low_links: Annotated[Mapping[int, int], 'Mapping from vertices to their lowest reachable index in the DFS traversal']
- on_stack: Annotated[Set[int], 'Set of vertices currently on the stack, for quick lookup']
- sccs: Annotated[Sequence[Sequence[int]], 'Accumulated strongly connected components, each a list of vertices']
- stack: Annotated[Sequence[int], 'Current DFS stack, with vertices in reverse order']
- with_counter(counter)
- with_indices(indices)
- with_low_links(low_links)
- with_on_stack(on_stack)
- with_sccs(sccs)
- with_stack(stack)