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

CompleteGraph represents a graph where every node is connected to every other node.

Examples

use graph_theory::{CompleteGraph, GraphEngine};
let graph = CompleteGraph::new(3);
assert_eq!(graph.count_nodes(), 3);
assert_eq!(graph.count_edges(), 3 * 2);

Implementations§

source§

impl CompleteGraph

source

pub fn new(rank: usize) -> Self

Creates a new complete graph with the given rank.

Examples
use graph_theory::CompleteGraph;
let graph = CompleteGraph::new(3);
source

pub fn directed(rank: usize) -> Self

Creates a new directed complete graph with the given rank.

Examples
use graph_theory::CompleteGraph;
let graph = CompleteGraph::directed(3);
source

pub fn check<G: GraphEngine>(graph: &G) -> Option<Self>

Check if the given graph is a complete graph, and if so, return it.

Trait Implementations§

source§

impl Clone for CompleteGraph

source§

fn clone(&self) -> CompleteGraph

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 CompleteGraph

source§

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

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

impl Display for CompleteGraph

source§

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

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

impl GraphEngine for CompleteGraph

source§

fn count_nodes(&self) -> usize

Count the number of nodes in the graph. Read more
source§

fn remove_node_with_edges(&mut self, _: usize)

Remove the given node and all edges connected to it. Read more
source§

fn insert_edge_with_nodes<E: Edge>(&mut self, _edge: E) -> EdgeInsertID

Insert edge to graph, if the nodes does not exist, also insert them. Read more
source§

fn remove_edge<E>(&mut self, _: E)where E: Into<EdgeRemoveAction>,

Remove edge by given edge-id or start and end node-id. Read more
source§

fn count_edges(&self) -> usize

Count the number of edges in the graph. Read more
source§

fn exception(&self, ability: &'static str) -> !

Mark the graph engine does not support the ability. Read more
source§

fn get_nodes(&self) -> GetNodesVisitor<'_, Self>

Arguments Read more
source§

fn insert_node(&mut self, node_id: usize) -> usize

Insert a node without any neighbors (edges). Read more
source§

fn remove_node(&mut self, node_id: usize)

Remove the given node. Read more
source§

fn get_edges(&self) -> GetEdgesVisitor<'_, Self>

source§

fn mut_edges(&mut self) -> MutEdgesVisitor<'_, Self>

Arguments Read more
source§

fn insert_edge<E: Edge>(&mut self, edge: E) -> EdgeInsertID

Insert a edge between two nodes. Read more
source§

impl PartialEq<CompleteGraph> for CompleteGraph

source§

fn eq(&self, other: &CompleteGraph) -> 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 Copy for CompleteGraph

source§

impl Eq for CompleteGraph

source§

impl StructuralEq for CompleteGraph

source§

impl StructuralPartialEq for CompleteGraph

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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<T, U> Into<U> for Twhere 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> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere 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.