grafos_tools/graph.rs
1use crate::{Edge, Vertice};
2use std::{collections::HashSet, fmt::Debug};
3
4/**
5The trait of a graph
6
7Defines the functions every graph must have.
8
9The generic parameters are:
10T: The type for the vertices IDs (must be orderable)
11E: The type for the edges, can be SymmetricEdge or AsymmetricEdge
12
13*/
14pub trait Graph<T: PartialOrd + Debug, E: Edge<T>> {
15 fn vertices(&self) -> &HashSet<Vertice<T>>;
16 fn edges(&self) -> &HashSet<E>;
17 fn add_vertice(&mut self, vertice: Vertice<T>);
18}