Struct udgraph::graph::DepGraphMut
source · [−]pub struct DepGraphMut<'a> { /* private fields */ }
Expand description
A mutable graph view.
This data structure provides a mutable view of a CoNLL-U dependency
graph. The view can be used to retrieve the dependents of a head or
the head of a dependent. In addition, the add_deprel
method can be used to add dependency relations to the graph.
Implementations
sourceimpl<'a> DepGraphMut<'a>
impl<'a> DepGraphMut<'a>
sourcepub fn add_deprel<S>(&mut self, triple: DepTriple<S>) -> Result<(), Error> where
S: Into<String>,
pub fn add_deprel<S>(&mut self, triple: DepTriple<S>) -> Result<(), Error> where
S: Into<String>,
Add a dependency relation between head
and dependent
.
If dependent
already has a head relation, this relation is removed
to ensure single-headedness.
sourcepub fn dependents(&self, head: usize) -> impl Iterator<Item = DepTriple<&str>>
pub fn dependents(&self, head: usize) -> impl Iterator<Item = DepTriple<&str>>
Return an iterator over the dependents of head
.
sourcepub fn head(&self, dependent: usize) -> Option<DepTriple<&str>>
pub fn head(&self, dependent: usize) -> Option<DepTriple<&str>>
Return the head relation of dependent
, if any.
Trait Implementations
sourceimpl<'a> Index<usize> for DepGraphMut<'a>
impl<'a> Index<usize> for DepGraphMut<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DepGraphMut<'a>
impl<'a> Send for DepGraphMut<'a>
impl<'a> Sync for DepGraphMut<'a>
impl<'a> Unpin for DepGraphMut<'a>
impl<'a> !UnwindSafe for DepGraphMut<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more