Skip to main content

GraphBase

Trait GraphBase 

Source
pub trait GraphBase {
    type NodeData;
    type EdgeData;

    // Required methods
    fn node_count(&self) -> usize;
    fn edge_count(&self) -> usize;
    fn contains_node(&self, index: NodeIndex) -> bool;
    fn contains_edge(&self, index: EdgeIndex) -> bool;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

图基础 trait

定义所有图类型必须实现的基本操作

Required Associated Types§

Source

type NodeData

节点数据类型

Source

type EdgeData

边数据类型

Required Methods§

Source

fn node_count(&self) -> usize

获取节点数量

Source

fn edge_count(&self) -> usize

获取边数量

Source

fn contains_node(&self, index: NodeIndex) -> bool

检查是否包含节点

Source

fn contains_edge(&self, index: EdgeIndex) -> bool

检查是否包含边

Provided Methods§

Source

fn is_empty(&self) -> bool

检查是否为空图

Implementors§

Source§

impl<T, E> GraphBase for Graph<T, E>