Struct caminos_lib::topology::projective::LeviProjective
source · pub struct LeviProjective { /* private fields */ }
Expand description
Taking the Levi graph of the projective plane as topology. Both points and lines are routers with attached servers. We put the points in the first offsets, the lines next.
Implementations§
source§impl LeviProjective
impl LeviProjective
pub fn new(arg: TopologyBuilderArgument<'_>) -> LeviProjective
Trait Implementations§
source§impl Debug for LeviProjective
impl Debug for LeviProjective
source§impl Quantifiable for LeviProjective
impl Quantifiable for LeviProjective
source§fn total_memory(&self) -> usize
fn total_memory(&self) -> usize
Get the total memory currently being employed by the implementing type. Both stack and heap.
source§fn print_memory_breakdown(&self)
fn print_memory_breakdown(&self)
Prints by stdout how much memory is used per component.
source§fn forecast_total_memory(&self) -> usize
fn forecast_total_memory(&self) -> usize
Get an estimation on how much memory the type could reach during the simulation.
source§impl Topology for LeviProjective
impl Topology for LeviProjective
source§fn neighbour(&self, router_index: usize, port: usize) -> (Location, usize)
fn neighbour(&self, router_index: usize, port: usize) -> (Location, usize)
Neighbours of a router: Location+link class index Routers should be before servers
source§fn server_neighbour(&self, server_index: usize) -> (Location, usize)
fn server_neighbour(&self, server_index: usize) -> (Location, usize)
The neighbour of a server: Location+link class index
source§fn distance(&self, origin: usize, destination: usize) -> usize
fn distance(&self, origin: usize, destination: usize) -> usize
Distance from a router to another.
source§fn amount_shortest_paths(&self, _origin: usize, _destination: usize) -> usize
fn amount_shortest_paths(&self, _origin: usize, _destination: usize) -> usize
Number of shortest paths from a router to another.
source§fn average_amount_shortest_paths(&self) -> f32
fn average_amount_shortest_paths(&self) -> f32
Average number of shortest paths from a router to another.
source§fn cartesian_data(&self) -> Option<&CartesianData>
fn cartesian_data(&self) -> Option<&CartesianData>
Specific for some toologies, but must be checkable for anyone
source§fn coordinated_routing_record(
&self,
_coordinates_a: &[usize],
_coordinates_b: &[usize],
_rng: Option<&mut StdRng>
) -> Vec<i32>
fn coordinated_routing_record( &self, _coordinates_a: &[usize], _coordinates_b: &[usize], _rng: Option<&mut StdRng> ) -> Vec<i32>
Specific for some toologies, but must be checkable for anyone
source§fn is_direction_change(
&self,
_router_index: usize,
_input_port: usize,
_output_port: usize
) -> bool
fn is_direction_change( &self, _router_index: usize, _input_port: usize, _output_port: usize ) -> bool
Specific for some toologies, but must be checkable for anyone Indicates if going from input_port to output_port implies a direction change. Used for the bubble routing.
fn num_routers(&self) -> usize
fn num_servers(&self) -> usize
fn maximum_degree(&self) -> usize
fn minimum_degree(&self) -> usize
fn ports(&self, router_index: usize) -> usize
source§fn up_down_distance(
&self,
_origin: usize,
_destination: usize
) -> Option<(usize, usize)>
fn up_down_distance( &self, _origin: usize, _destination: usize ) -> Option<(usize, usize)>
For topologies containing the so called up/down paths. Other topologies should return always
None
.
If the return is Some((u,d))
it means there is an initial up sub-path of length u
followed by a down sub-path of length d
starting at origin
and ending at destination
. A return value of None
means there is no up/down path from origin
to destination
.
Some general guidelines, although it is not clear if they must hold always: Read moresource§fn neighbour_router_iter<'a>(
&'a self,
router_index: usize
) -> Box<dyn Iterator<Item = NeighbourRouterIteratorItem> + 'a>
fn neighbour_router_iter<'a>( &'a self, router_index: usize ) -> Box<dyn Iterator<Item = NeighbourRouterIteratorItem> + 'a>
Iterate over the neighbour routers, skipping non-connected ports and ports towards servers.
You may want to reimplement this when implementing the trait for your type.
source§fn dragonfly_size(&self) -> Option<ArrangementSize>
fn dragonfly_size(&self) -> Option<ArrangementSize>
Information for Dragonfly-like networks.
source§fn bfs(&self, origin: usize, class_weight: Option<&[usize]>) -> Vec<usize>
fn bfs(&self, origin: usize, class_weight: Option<&[usize]>) -> Vec<usize>
Breadth First Search to compute distances from a router to all others.
It may use weights, but it there are multiple paths with different distances it may give a non-minimal distance, since it is not Dijkstra.
fn compute_distance_matrix( &self, class_weight: Option<&[usize]> ) -> Matrix<usize>
fn floyd(&self) -> Matrix<usize>
source§fn compute_amount_shortest_paths(&self) -> (Matrix<usize>, Matrix<usize>)
fn compute_amount_shortest_paths(&self) -> (Matrix<usize>, Matrix<usize>)
Return a pair of matrices
(D,A)
with D[i,j]
being the distance from i
to j
and A[i,j]
being the number of paths of length D[i,j]
from i
to j
.source§fn components(&self, allowed_classes: &[bool]) -> Vec<Vec<usize>>
fn components(&self, allowed_classes: &[bool]) -> Vec<Vec<usize>>
Find the components of the subtopology induced via the allowed links.
Returns vector
ret
with ret[k]
containing the vertices in the k
-th component.source§fn compute_near_far_matrices(&self) -> (Matrix<usize>, Matrix<usize>)
fn compute_near_far_matrices(&self) -> (Matrix<usize>, Matrix<usize>)
returns a couple matrices
(N,F)
with
N[u,v]
= number of neighbours w of v with D(u,v)>D(u,w)
.
F[u,v]
= number of neighbours w of v with D(u,v)<D(u,w)
.
A router v
with F[u,v]=0
is called a boundary vertex of u.source§fn eccentricity(&self, router_index: usize) -> usize
fn eccentricity(&self, router_index: usize) -> usize
Computes the eccentricy of a router. That is, the greatest possible length of a shortest path from that router to any other.
Auto Trait Implementations§
impl !RefUnwindSafe for LeviProjective
impl !Send for LeviProjective
impl !Sync for LeviProjective
impl Unpin for LeviProjective
impl !UnwindSafe for LeviProjective
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