1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//!
//! Contains the basic traits and structs needed to define graphs and work on them.
//!
//!
//!

///
/// Expands to the body of a Constraint implementation that
/// has no constraints.
///
/// I.e. invariant_holds() always returns `true` and the other functions
/// all call `BaseGraph`'s constrained functions.
///
///
#[macro_export]
macro_rules! impl_base_constraint{
{} => {
	fn invariant_holds(&self) -> bool {
		true
	}
	
	unsafe fn uncon_add_vertex(&mut self, v: Self::Vertex) -> Result<(), ()> {
		self.add_vertex(v)
	}
	
	unsafe fn uncon_remove_vertex(&mut self, v: Self::Vertex) -> Result<(), ()> {
		self.remove_vertex(v)
	}
	
	unsafe fn uncon_add_edge(&mut self, e: BaseEdge<Self::Vertex, Self::Weight>) -> Result<(), ()> {
		self.add_edge(e)
	}
	
	unsafe fn uncon_remove_edge(&mut self, e: BaseEdge<Self::Vertex, Self::Weight>) -> Result<(), ()> {
		self.remove_edge(e)
	}
}
}
#[macro_use]
mod graph_wrapper;
mod base_graph;
mod base_edge;
mod constrained_graph;

#[macro_use]
pub mod constraint;


pub use self::base_graph::*;
pub use self::base_edge::*;
pub use self::constrained_graph::*;
pub use self::graph_wrapper::*;