cutcutcodec.core.analysis.graph.find
Allow to search for elements in the graph.
Functions
|
Search in the graph for the edge that corresponds to the stream provided. |
Details
- cutcutcodec.core.analysis.graph.find.find_edge_from_edge_tree(graph: MultiDiGraph, stream: Stream, nbunch: Iterable[tuple[str, str, str]] | None = None, pointer: bool = False) tuple[str, str, str][source]
Search in the graph for the edge that corresponds to the stream provided.
Parameters
- graphnetworkx.MultiDiGraph
The assembly graph.
- stream
cutcutcodec.core.classes.stream.Stream One of the output stream of the node. It can be a stream of any type.
- nbunchtyping.Iterable[tuple[str, str, str]], optional
The edges to be analyzed. By default all edges are analyzed.
- pointerboolean
If True, returns only if the node stream is the same objet as the provide stream. If False (default), compare the streams contents. It is slower but stronger.
Returns
- edgetuple[str, str, str]
The name of the corresponding edge.
Raises
- KeyError
If no edge matches.
Examples
>>> from cutcutcodec.core.analysis.graph.find import find_edge_from_edge_tree >>> from cutcutcodec.core.classes.container import ContainerOutput >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph >>> from cutcutcodec.core.filter.audio.subclip import FilterAudioSubclip >>> from cutcutcodec.core.generation.audio.noise import GeneratorAudioNoise >>> container_out = ContainerOutput( ... FilterAudioSubclip(GeneratorAudioNoise(0).out_streams, 1, 2).out_streams ... ) >>> graph = tree_to_graph(container_out) >>> find_edge_from_edge_tree(graph, container_out.in_streams[0]) ('filter_audio_subclip_1', 'container_output_1', '0->0') >>>