Struct acyclic_network::Network
[−]
[src]
pub struct Network<N: NodeType, L: Copy + Debug + Send + Sized, EXTID: Copy + Debug + Send + Sized + Ord = ExternalId> { /* fields omitted */ }
A directed, acylic network.
Methods
impl<N: NodeType, L: Copy + Debug + Send + Sized, EXTID: Copy + Debug + Send + Sized + Ord> Network<N, L, EXTID>
[src]
fn new() -> Network<N, L, EXTID>
[src]
fn node_count(&self) -> usize
[src]
fn link_count(&self) -> usize
[src]
fn node(&self, node_idx: NodeIndex) -> &Node<N, EXTID>
[src]
fn node_mut(&mut self, node_idx: NodeIndex) -> &mut Node<N, EXTID>
[src]
fn link(&self, link_idx: LinkIndex) -> &Link<L, EXTID>
[src]
fn link_mut(&mut self, link_idx: LinkIndex) -> &mut Link<L, EXTID>
[src]
fn nodes(&self) -> &[Node<N, EXTID>]
[src]
fn each_node_with_index<F>(&self, f: F) where
F: FnMut(&Node<N, EXTID>, NodeIndex),
[src]
F: FnMut(&Node<N, EXTID>, NodeIndex),
fn link_iter_for_node<'a>(
&'a self,
node_idx: NodeIndex
) -> LinkIter<'a, L, EXTID>
[src]
&'a self,
node_idx: NodeIndex
) -> LinkIter<'a, L, EXTID>
fn link_ref_iter_for_node<'a>(
&'a self,
node_idx: NodeIndex
) -> LinkRefIter<'a, N, L, EXTID>
[src]
&'a self,
node_idx: NodeIndex
) -> LinkRefIter<'a, N, L, EXTID>
fn each_active_forward_link_of_node<F>(&self, node_idx: NodeIndex, f: F) where
F: FnMut(NodeIndex, L),
[src]
F: FnMut(NodeIndex, L),
fn each_link_ref<F>(&self, f: F) where
F: FnMut(LinkRefItem<N, L, EXTID>),
[src]
F: FnMut(LinkRefItem<N, L, EXTID>),
fn each_link_mut<F>(&mut self, f: F) where
F: FnMut(&mut Link<L, EXTID>),
[src]
F: FnMut(&mut Link<L, EXTID>),
fn random_inactive_link_index<R: Rng>(&self, rng: &mut R) -> Option<LinkIndex>
[src]
Complexity
O(number of links)
fn random_active_link_index<R: Rng>(&self, rng: &mut R) -> Option<LinkIndex>
[src]
Complexity
O(number of links)
fn random_link_index<R: Rng>(&self, rng: &mut R) -> Option<LinkIndex>
[src]
Complexity
O(1)
fn remove_all_outgoing_links_of_node(&mut self, node_idx: NodeIndex)
[src]
Removes all outgoing links of node node_idx
.
XXX: This can be optimized.
Complexity
O(k), where k
is the number of edges of node_idx
.
fn remove_all_incoming_links_of_node(&mut self, node_idx: NodeIndex)
[src]
Removes all incoming links to node node_idx
.
XXX: This can be optimized.
fn remove_all_inout_links_of_node(&mut self, node_idx: NodeIndex)
[src]
Removes all links to and from node node_idx
.
fn remove_node(&mut self, node_idx: NodeIndex)
[src]
Remove the node with index node_idx
including
all incoming and outgoing links.
Moves the last node in the nodes array into the empty place and rewires all links. As such, this is a quite heavy operation!
Danger!
The external NodeIndex of the last node is changed!
Complexity
Worst case O(e), where e
is the total number of edges in the graph.
fn add_node(&mut self, node_type: N, external_node_id: EXTID) -> NodeIndex
[src]
Adds a new node to the network with type node_type
and the associated
id external_node_id
. The external_node_id
is stored in the node and
can be retrieved later on.
fn find_random_unconnected_link_no_cycle<R: Rng>(
&self,
rng: &mut R
) -> Option<(NodeIndex, NodeIndex)>
[src]
&self,
rng: &mut R
) -> Option<(NodeIndex, NodeIndex)>
Returns a random link between two unconnected nodes, which would not introduce a cycle. Return None is no such exists.
fn link_would_cycle(
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
[src]
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
Returns true if the introduction of this directed link would lead towards a cycle.
fn valid_link(
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> Result<(), &'static str>
[src]
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> Result<(), &'static str>
fn disable_link_index(&mut self, link_idx: LinkIndex) -> bool
[src]
fn enable_link_index(&mut self, link_idx: LinkIndex) -> bool
[src]
fn disable_link(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
fn enable_link(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
fn first_link_of_node(&self, node_idx: NodeIndex) -> Option<&Link<L, EXTID>>
[src]
fn last_link_of_node(&self, node_idx: NodeIndex) -> Option<&Link<L, EXTID>>
[src]
fn add_link(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID
) -> LinkIndex
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID
) -> LinkIndex
fn add_link_unordered(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID
) -> LinkIndex
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID
) -> LinkIndex
fn add_link_with_active(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID,
active: bool
) -> LinkIndex
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex,
weight: L,
external_link_id: EXTID,
active: bool
) -> LinkIndex
fn has_link(
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
[src]
&self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
fn remove_link_at(&mut self, link_index: LinkIndex)
[src]
Remove the link at index link_index
.
fn remove_link(
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
[src]
&mut self,
source_node_idx: NodeIndex,
target_node_idx: NodeIndex
) -> bool
Remove the first link that matches source_node_idx
and target_node_idx
.
XXX
Trait Implementations
impl<N: Clone + NodeType, L: Clone + Copy + Debug + Send + Sized, EXTID: Clone + Copy + Debug + Send + Sized + Ord> Clone for Network<N, L, EXTID>
[src]
fn clone(&self) -> Network<N, L, EXTID>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more