DTFGraph

Struct DTFGraph 

Source
pub struct DTFGraph { /* private fields */ }
Expand description

The augmentation data structure.

Implementations§

Source§

impl DTFGraph

Source

pub fn get_depth(&self) -> usize

Returns the depth of augmentation.

Source

pub fn to_undirected<G>(&self) -> G
where G: MutableGraph,

Source

pub fn layer(&mut self, depth: usize) -> DTFLayer<'_>

Source

pub fn num_arcs_at_depth(&self, depth: usize) -> usize

Source

pub fn add_vertex(&mut self, u: Vertex)

Source

pub fn orient_deep<G>(graph: &G, depth: usize) -> DTFGraph
where G: Graph,

Source

pub fn edge_subgraph<I>(&self, it: I) -> DTFGraph
where I: Iterator<Item = (Vertex, Vertex)>,

Source

pub fn orient<G>(graph: &G) -> DTFGraph
where G: Graph,

Source

pub fn add_arc(&mut self, u: &Vertex, v: &Vertex, depth: usize)

Source

pub fn has_arc_at(&self, u: &Vertex, v: &Vertex, depth: usize) -> bool

Source

pub fn get_arc_depth(&self, u: &Vertex, v: &Vertex) -> Option<u32>

Source

pub fn arcs(&self) -> DTFArcIterator<'_>

Source

pub fn arcs_at(&self, depth: usize) -> DTFArcIterator<'_>

Source

pub fn in_neighbourhoods_iter(&self) -> DTFNIterator<'_>

Source

pub fn in_neighbourhoods_iter_at(&self, depth: usize) -> DTFNIterator<'_>

Source

pub fn in_neighbours_at<'a>( &'a self, u: &Vertex, depth: usize, ) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Source

pub fn in_neighbours_with_weights(&self, u: &Vertex) -> FxHashMap<Vertex, u32>

Source

pub fn small_distance(&self, u: &Vertex, v: &Vertex) -> Option<u32>

Returns the distance between the vertices u and v if it it smaller than the depth of the augmentation. Otherwise returns None.

Source

pub fn augment(&mut self, depth: usize, frat_depth: usize)

Increases the depth of the augmentation.

§Arguments
  • depth - The target depth of the augmentation
  • frat_depth - An optimisation parameter. Larger values increase computation time, recommended values are 2 or 1.
Source

pub fn domset(&mut self, radius: u32) -> VertexSet

Computes an approximate $r$-dominating set of the underlying graph, where $r$ is the provided radius.

Note that if radius is larger than the current augmentation depth then graph is augmented further until the depth matches the radius.

The approximation ratio is a function of the graph’s ‘sparseness’. See [Dvořák13] and [Reidl16] for the underlying theory and [Brown20] for the details of this specific version of the algorithm.

[Dvořák13] Dvořák, Z. (2013). Constant-factor approximation of the domination number in sparse graphs. European Journal of Combinatorics, 34(5), 833-840.

[Brown20] Brown, C.T., Moritz, D., O’Brien, M.P., Reidl, F., Reiter, T. and Sullivan, B.D., 2020. Exploring neighborhoods in large metagenome assembly graphs using spacegraphcats reveals hidden sequence diversity. Genome biology, 21(1), pp.1-16.

[Reidl16] Reidl, F. (2016). Structural sparseness and complex networks (No. RWTH-2015-07564). Fachgruppe Informatik.

Trait Implementations§

Source§

impl Digraph for DTFGraph

Source§

fn has_arc(&self, u: &Vertex, v: &Vertex) -> bool

Returns whether the arc uv exists in the digraph.
Source§

fn in_degree(&self, u: &Vertex) -> u32

Returns the number of arcs which point to u in the digraph.
Source§

fn out_degree(&self, u: &Vertex) -> u32

Returns the number of arcs which point away from u in the digraph.
Source§

fn out_neighbours<'a>( &'a self, _: &Vertex, ) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Returns an iterator over the out-neighbours of u.
Source§

fn in_neighbours<'a>( &'a self, u: &Vertex, ) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Returns an iterator over the in-neighbours of u.
Source§

fn in_degrees(&self) -> VertexMap<u32>

Returns the in-degrees of all vertices in the digraph as a map.
Source§

fn out_degrees(&self) -> VertexMap<u32>

Returns the out-degrees of all vertices in the digraph as a map.
Source§

fn neighbours<'a>( &'a self, u: &Vertex, ) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Returns the set of all in- and out-neighbours of u as an iterator.
Source§

impl Graph for DTFGraph

Source§

fn num_vertices(&self) -> usize

Returns the number of vertices in the graph.
Source§

fn num_edges(&self) -> usize

Returns the number of edges in the graph.
Source§

fn contains(&self, u: &Vertex) -> bool

Returns whether the vertex u is contained in the graph.
Source§

fn vertices<'a>(&'a self) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Returns an iterator to this graph’s vertices.
Source§

fn adjacent(&self, u: &Vertex, v: &Vertex) -> bool

Returns whether vertices u and v are connected by an edge.
Source§

fn neighbours<'a>( &'a self, _: &Vertex, ) -> Box<dyn Iterator<Item = &Vertex> + 'a>

Returns an iterator over the neighbours of u.
Source§

fn degree(&self, u: &Vertex) -> u32

Returns the number of edges incident to u in the graph.
Source§

fn degrees(&self) -> VertexMap<u32>

Returns the degrees of all vertices in the graph as a map.
Source§

fn len(&self) -> usize

Alias for Graph::num_vertices()
Source§

fn is_empty(&self) -> bool

Returns true if the graph contains no vertices
Source§

fn neighbourhood<'a, I>(&self, vertices: I) -> FxHashSet<Vertex>
where I: Iterator<Item = &'a Vertex>, Vertex: 'a,

Given an iterator vertices over vertices, returns all vertices of the graph which are neighbours of those vertices but not part of vertices themselves.
Source§

fn closed_neighbourhood<'a, I>(&self, vertices: I) -> FxHashSet<Vertex>
where I: Iterator<Item = &'a Vertex>, Vertex: 'a,

Given an iterator vertices over vertices, returns all vertices of the graph which are neighbours of those vertices as well as all vertices contained in vertices.
Source§

fn r_neighbours(&self, u: &Vertex, r: usize) -> FxHashSet<Vertex>

Returns all vertices which lie within distance at most r to u.
Source§

fn r_neighbourhood<'a, I>(&self, vertices: I, r: usize) -> FxHashSet<Vertex>
where I: Iterator<Item = &'a Vertex>, Vertex: 'a,

Given an iterator vertices over vertices and a distance r, returns all vertices of the graph which are within distance at most r to vertices contained in vertices.
Source§

fn subgraph<'a, M, I>(&self, vertices: I) -> M
where M: MutableGraph, I: Iterator<Item = &'a Vertex>,

Returns the subgraph induced by the vertices contained in vertices.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<D> ArcIterable<D> for D
where D: Digraph,

Source§

fn arcs(&self) -> ArcIterator<'_, D>

Returns an ArcIterator over the arcs of this digraph.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<D> DiNeighIterable<D> for D
where D: Digraph,

Source§

fn in_neighbourhoods(&self) -> DiNeighIterator<'_, D>

Returns a DiNeighIterator over all in-neighbourhoods of this graph.
Source§

fn out_neighbourhoods(&self) -> DiNeighIterator<'_, D>

Returns a DiNeighIterator over all out-neighbourhoods of this graph.
Source§

impl<G> EdgeIterable<G> for G
where G: Graph,

Source§

fn edges(&self) -> EdgeIterator<'_, G>

Returns an EdgeIterator over the edges of this graph.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<G> GraphAlgorithms for G
where G: Graph,

Source§

fn components(&self) -> Vec<HashSet<u32, BuildHasherDefault<FxHasher>>>

Returns the connected components of this graph.
Source§

fn degeneracy( &self, ) -> (u32, u32, Vec<u32>, HashMap<u32, u32, BuildHasherDefault<FxHasher>>)

Computes the degeneracy (approximate), core-numbers and a degeneracy-ordering of this graph. The return value contains four values: Read more
Source§

fn is_bipartite(&self) -> BipartiteWitness

Tests whether the graph is bipartite and returns a witness.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<G> MixedIterable<G> for G
where G: Graph,

Source§

fn vertices_and_edges(&self) -> MixedIterator<'_, G>

Returns an EdgeIterator over the edges of this graph.
Source§

impl<G> NeighIterable<G> for G
where G: Graph,

Source§

fn neighbourhoods(&self) -> NeighIterator<'_, G>

Returns a NeighIterator for the graph.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<G> WriteGraph for G
where G: Graph,

Source§

fn write_txt(&self, filename: &str) -> Result<(), Error>

Source§

fn write_gzipped(&self, filename: &str) -> Result<(), Error>