Struct graph_types::CompleteGraph
source · 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
impl CompleteGraph
sourcepub fn new(rank: usize) -> Self
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);
sourcepub fn directed(rank: usize) -> Self
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);
sourcepub fn check<G: GraphEngine>(graph: &G) -> Option<Self>
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
impl Clone for CompleteGraph
source§fn clone(&self) -> CompleteGraph
fn clone(&self) -> CompleteGraph
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CompleteGraph
impl Debug for CompleteGraph
source§impl Display for CompleteGraph
impl Display for CompleteGraph
source§impl GraphEngine for CompleteGraph
impl GraphEngine for CompleteGraph
source§fn count_nodes(&self) -> usize
fn count_nodes(&self) -> usize
Count the number of nodes in the graph. Read more
source§fn remove_node_with_edges(&mut self, _: usize)
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
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>,
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
fn count_edges(&self) -> usize
Count the number of edges in the graph. Read more
source§fn exception(&self, ability: &'static str) -> !
fn exception(&self, ability: &'static str) -> !
Mark the graph engine does not support the ability. Read more
source§fn insert_node(&mut self, node_id: usize) -> usize
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)
fn remove_node(&mut self, node_id: usize)
Remove the given node. Read more
fn get_edges(&self) -> GetEdgesVisitor<'_, Self>
source§fn mut_edges(&mut self) -> MutEdgesVisitor<'_, Self>
fn mut_edges(&mut self) -> MutEdgesVisitor<'_, Self>
Arguments Read more
source§fn insert_edge<E: Edge>(&mut self, edge: E) -> EdgeInsertID
fn insert_edge<E: Edge>(&mut self, edge: E) -> EdgeInsertID
Insert a edge between two nodes. Read more
source§impl PartialEq<CompleteGraph> for CompleteGraph
impl PartialEq<CompleteGraph> for CompleteGraph
source§fn eq(&self, other: &CompleteGraph) -> bool
fn eq(&self, other: &CompleteGraph) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for CompleteGraph
impl Eq for CompleteGraph
impl StructuralEq for CompleteGraph
impl StructuralPartialEq for CompleteGraph
Auto Trait Implementations§
impl RefUnwindSafe for CompleteGraph
impl Send for CompleteGraph
impl Sync for CompleteGraph
impl Unpin for CompleteGraph
impl UnwindSafe for CompleteGraph
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more