OrientedGraph

Struct OrientedGraph 

Source
pub struct OrientedGraph(/* private fields */);
Expand description

Loopless oriented graphs.

Every pair of vertices has at most one edge.

Implementations§

Source§

impl OrientedGraph

Source

pub fn as_directed(&self) -> &DirectedGraph

Source

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

Create an oriented 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
  • If both arcs (u, v) and (v, u) are provided
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 empty(n: usize) -> Self

Oriented graph with n vertices and no edge.

use flag_algebra::flags::OrientedGraph;
assert_eq!(OrientedGraph::empty(4), OrientedGraph::new(4, []));
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::{OrientedGraph, Arc};
let p3 = OrientedGraph::new(3, [(0,1), (1,2)]);
assert_eq!(p3.arc(0, 1), Arc::Edge);
assert_eq!(p3.arc(1, 0), Arc::BackEdge);
assert_eq!(p3.arc(0, 2), Arc::None);
Source

pub fn add_sink(&self) -> Self

Oriented graph obtained from self by adding a vertex and every edge from the rest of the graph to that vertex.

Trait Implementations§

Source§

impl Canonize for OrientedGraph

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 OrientedGraph

Source§

fn clone(&self) -> OrientedGraph

Returns a duplicate 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 OrientedGraph

Source§

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

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

impl<'de> Deserialize<'de> for OrientedGraph

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 OrientedGraph

Source§

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

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

impl Draw for OrientedGraph

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 OrientedGraph

Source§

const NAME: &'static str = "OrientedGraph"

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

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

Returns the subflag induced by the vertices in the slice set.
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 OrientedGraph

Source§

fn cmp(&self, other: &OrientedGraph) -> 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,

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

impl PartialEq for OrientedGraph

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for OrientedGraph

Source§

fn partial_cmp(&self, other: &OrientedGraph) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for OrientedGraph

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 SubFlag<OrientedGraph> for TriangleFree

Source§

const SUBCLASS_NAME: &'static str = "Triangle-free oriented graph"

Unique name for the subclass. This is used for naming the memoization directory.
Source§

fn is_in_subclass(flag: &OrientedGraph) -> bool

Identifier function for the subclass.
Source§

const HEREDITARY: bool = F::HEREDITARY

Source§

impl Eq for OrientedGraph

Source§

impl StructuralPartialEq for OrientedGraph

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

unsafe fn to_subset_unchecked(&self) -> SS

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

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,

Source§

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§

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

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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