use std::{collections::HashSet, hash::Hash};
use serde::{Serialize};
pub trait HgBasis: PartialEq + Eq + Hash + Clone + Serialize {
fn new_empty() -> Self;
fn len(&self) -> usize;
fn intersect_with(&mut self, rhs: &Self);
fn intersection(&self, rhs: &Self) -> Self;
fn union_with(&mut self, rhs: &Self);
fn union(&self, rhs: &Self) -> Self;
fn add_node(&mut self, node: &Self) {
self.union_with(node);
}
fn add_nodes(&mut self, nodes: &HashSet<Self>) {
for node in nodes.iter() {
self.union_with(node);
}
}
fn remove_node(&mut self, node: &Self);
fn complement(&self, rhs: &Self) -> Self;
fn covers_basis(&self, basis: &Self) -> bool {
let intersection = self.intersection(basis);
intersection == *basis
}
fn nodes(&self) -> HashSet<Self>;
}