pub struct DirectedGraph { /* private fields */ }
Expand description

Loopless directed graphs.

The possible relations between two vertices is described by the type Arc.

Implementations§

source§

impl DirectedGraph

source

pub fn new<I>(n: usize, arcs: I) -> Self
where I: IntoIterator<Item = (usize, usize)>,

Create a directed graph with n vertices and arcs in arcs.

§Panics
  • If arcs contains vertices not in {0, ..., n-1}
  • If a loop (u, u) is provided
  • If some arc is provided twice
use flag_algebra::flags::OrientedGraph;

// Oriented path with 3 vertices `0 -> 1 -> 2`
let p3 = OrientedGraph::new(3, [(0, 1), (1, 2)]);
source

pub fn size(&self) -> usize

Number of vertices

source

pub fn out_nbrs(&self, v: usize) -> Vec<usize>

Out-neigborhood of v.

use flag_algebra::flags::OrientedGraph;
let p3 = OrientedGraph::new(3, [(0,1), (1,2)]);
assert_eq!(p3.out_nbrs(1), vec![2]);
source

pub fn in_nbrs(&self, v: usize) -> Vec<usize>

In-neigborhood of v.

use flag_algebra::flags::OrientedGraph;
let p3 = OrientedGraph::new(3, [(0, 1), (1, 2)]);
assert_eq!(p3.in_nbrs(1), vec![0]);
source

pub fn arc(&self, u: usize, v: usize) -> Arc

Oriented relation between u to v.

use flag_algebra::flags::{DirectedGraph, Arc};
let g = DirectedGraph::new(3, [(0, 1), (1, 2), (2, 1)]);
assert_eq!(g.arc(0, 1), Arc::Edge);
assert_eq!(g.arc(1, 0), Arc::BackEdge);
assert_eq!(g.arc(0, 2), Arc::None);
assert_eq!(g.arc(1, 2), Arc::Reciprocal);

Trait Implementations§

source§

impl Canonize for DirectedGraph

source§

fn size(&self) -> usize

Return the number of vertices. Read more
source§

fn invariant_neighborhood(&self, v: usize) -> Vec<Vec<usize>>

Return lists of vertices that are invariant isomorphism. Read more
source§

fn apply_morphism(&self, p: &[usize]) -> Self

Return the result of the action of a permuation p on the object. Read more
source§

fn invariant_coloring(&self) -> Option<Vec<u64>>

Optionally returns a value for each node that is invariant by isomorphism. Read more
source§

fn canonical(&self) -> Self

Computes a canonical form of a combinatorial object. Read more
source§

fn canonical_typed(&self, sigma: usize) -> Self

The “typed” objects refers to the case where only the action of permutations that are constant on 0..sigma are considered. Read more
source§

fn morphism_to_canonical(&self) -> Vec<usize>

Return a permutation p such that self.apply_morphism(&p) = self.canonical(). Read more
source§

fn morphism_to_canonical_typed(&self, sigma: usize) -> Vec<usize>

Return a permutation phi such that g.apply_morphism(&phi) = canonical_typed(&g, sigma). Read more
source§

fn automorphisms(&self) -> AutomorphismIterator<Self>

Iterator on the automorphism group of g. Read more
source§

fn stabilizer(&self, sigma: usize) -> AutomorphismIterator<Self>

Iterator on the automorphisms of g that fix the sigma first vertices. Read more
source§

impl Clone for DirectedGraph

source§

fn clone(&self) -> DirectedGraph

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DirectedGraph

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for DirectedGraph

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for DirectedGraph

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Draw for DirectedGraph

source§

fn draw_with_parameters<C>(&self, col: C, type_size: usize) -> SVG
where C: FnMut(usize) -> usize,

source§

fn draw(&self) -> SVG

source§

fn draw_typed(&self, type_size: usize) -> SVG

source§

fn to_svg_file(&self, filename: &str)

source§

impl Flag for DirectedGraph

source§

fn induce(&self, p: &[usize]) -> Self

Returns the subflag induced by the vertices in the slice set.
source§

const NAME: &'static str = "DirectedGraph"

A unique name for this type of flags. For instance “Graph”. This nameis used for naming the associated data subdirectory.
source§

fn size_zero_flags() -> Vec<Self>

Returns the set of all flags of size 0. Read more
source§

fn superflags(&self) -> Vec<Self>

Return the list of flags of size self.size() + 1 that contain self as an induced subflag. Read more
source§

const HEREDITARY: bool = true

Setting this parameter to false deactivate checks that induced subflags exists. Must be true in every classic case.
source§

fn generate_next(previous: &[Self]) -> Vec<Self>

Return the list of flags of size self.size() + 1 that contain self as an induced subflag reduced modulo isomorphism.
source§

fn generate(n: usize) -> Vec<Self>

Return the list of flags of size n reduced modulo isomorphism.
source§

fn generate_typed_up(type_flag: &Self, g_vec: &[Self]) -> Vec<Self>

Return the list of flags of g_vec that can be rooted on the flag type_flag. Each different way to root this flag give a different flag in the result.
source§

fn generate_typed(type_flag: &Self, size: usize) -> Vec<Self>

Return the list of flag of size size rooted on type_flag reduced modulo (typed) isomorphism.
source§

fn select_type(&self, eta: &[usize]) -> Self

Reorder self so that the eta.len() first vertices are the values of eta in the corresponding order.
source§

impl Ord for DirectedGraph

source§

fn cmp(&self, other: &DirectedGraph) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for DirectedGraph

source§

fn eq(&self, other: &DirectedGraph) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for DirectedGraph

source§

fn partial_cmp(&self, other: &DirectedGraph) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for DirectedGraph

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for DirectedGraph

source§

impl StructuralPartialEq for DirectedGraph

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<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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<F> Html for F
where F: Draw,

source§

fn print_html<W>(&self, w: &mut W) -> Result<(), Error>
where W: Write,

source§

const LATEX: bool = false

source§

fn html(&self, name: &str) -> Result<()>

True if Mathjax need to be loaded
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,