pub struct TSGraph {
pub headers: Vec<Header>,
pub graphs: HashMap<BString, GraphSection>,
pub links: Vec<InterGraphLink>,
/* private fields */
}
Expand description
The complete transcript segment graph containing multiple graph sections
Fields§
§headers: Vec<Header>
§graphs: HashMap<BString, GraphSection>
§links: Vec<InterGraphLink>
Implementations§
Source§impl TSGraph
impl TSGraph
Sourcepub fn builder() -> TSGraphBuilder
pub fn builder() -> TSGraphBuilder
Create an instance of TSGraph
using the builder syntax
Source§impl TSGraph
impl TSGraph
pub fn from_reader<R: BufRead>(reader: R) -> Result<Self>
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Parse a TSG file and construct a TSGraph
Sourcepub fn graph(&self, id: &str) -> Option<&GraphSection>
pub fn graph(&self, id: &str) -> Option<&GraphSection>
Get a graph section by its ID
pub fn graph_mut(&mut self, id: &str) -> Option<&mut GraphSection>
Sourcepub fn default_graph(&self) -> Option<&GraphSection>
pub fn default_graph(&self) -> Option<&GraphSection>
get default graph
pub fn default_graph_mut(&mut self) -> Option<&mut GraphSection>
Sourcepub fn node(&self, graph_id: &str, node_id: &str) -> Option<&NodeData>
pub fn node(&self, graph_id: &str, node_id: &str) -> Option<&NodeData>
Get a node by its ID and graph ID
Sourcepub fn edge(&self, graph_id: &str, edge_id: &str) -> Option<&EdgeData>
pub fn edge(&self, graph_id: &str, edge_id: &str) -> Option<&EdgeData>
Get an edge by its ID and graph ID
Sourcepub fn chain_nodes(
&self,
graph_id: &str,
chain_id: &BStr,
) -> Option<Vec<NodeIndex>>
pub fn chain_nodes( &self, graph_id: &str, chain_id: &BStr, ) -> Option<Vec<NodeIndex>>
Get the nodes in a chain in order
Sourcepub fn chain_edges(
&self,
graph_id: &str,
chain_id: &BStr,
) -> Option<Vec<EdgeIndex>>
pub fn chain_edges( &self, graph_id: &str, chain_id: &BStr, ) -> Option<Vec<EdgeIndex>>
Get the edges in a chain in order
Sourcepub fn find_node_id_by_idx(
&self,
graph_id: &str,
node_idx: NodeIndex,
) -> Option<&BString>
pub fn find_node_id_by_idx( &self, graph_id: &str, node_idx: NodeIndex, ) -> Option<&BString>
Helper method to find a node’s ID by its index
pub fn node_by_idx( &self, graph_id: &str, node_idx: NodeIndex, ) -> Option<&NodeData>
pub fn edge_by_idx( &self, graph_id: &str, edge_idx: EdgeIndex, ) -> Option<&EdgeData>
Sourcepub fn traverse_by_id(&self, graph_id: &str) -> Result<Vec<TSGPath<'_>>>
pub fn traverse_by_id(&self, graph_id: &str) -> Result<Vec<TSGPath<'_>>>
Traverse the graph and return all valid paths from source nodes to sink nodes.
Sourcepub fn traverse_all_graphs(&self) -> Result<Vec<TSGPath<'_>>>
pub fn traverse_all_graphs(&self) -> Result<Vec<TSGPath<'_>>>
traverse all graphs
pub fn to_dot_by_id( &self, graph_id: &str, node_label: bool, edge_label: bool, ) -> Result<String>
pub fn to_json_by_id(&self, graph_id: &str) -> Result<Value>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TSGraph
impl RefUnwindSafe for TSGraph
impl Send for TSGraph
impl Sync for TSGraph
impl Unpin for TSGraph
impl UnwindSafe for TSGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more