Struct net_ensembles::generic_graph::GenericGraph
source · [−]pub struct GenericGraph<T, A> { /* private fields */ }
Expand description
Generic graph implementation
- contains multiple measurable quantities
Implementations
sourceimpl<T, A> GenericGraph<T, A>where
T: Node,
A: AdjContainer<T>,
impl<T, A> GenericGraph<T, A>where
T: Node,
A: AdjContainer<T>,
sourcepub fn clone_topology<F, T2>(
&self,
map: F
) -> GenericGraph<T2, NodeContainer<T2>>where
F: FnMut(&T) -> T2,
pub fn clone_topology<F, T2>(
&self,
map: F
) -> GenericGraph<T2, NodeContainer<T2>>where
F: FnMut(&T) -> T2,
Use the topology from another graph and create a new one with the same topology but the function ‘map’ is used to map what is contained in the original Graph to the newly created one.
sourceimpl<T, A> GenericGraph<T, A>
impl<T, A> GenericGraph<T, A>
sourceimpl<T, A> GenericGraph<T, A>where
A: AdjContainer<T>,
impl<T, A> GenericGraph<T, A>where
A: AdjContainer<T>,
sourcepub fn from_vec(contained: Vec<T>) -> Self
pub fn from_vec(contained: Vec<T>) -> Self
create a new graph
- graph will contain
contained.len()
vertices, which will contain the corresponding entries of the vectorcontained
- graph will not contain any edges upon creation
use net_ensembles::{GenericGraph, graph::NodeContainer};
let graph = GenericGraph::<_, NodeContainer::<_>>::from_vec(vec!["first", "second", "third"]);
assert_eq!(graph.at(0), &"first");
assert_eq!(graph.at(1), &"second");
assert_eq!(graph.at(2), &"third");
assert_eq!(graph.vertex_count(), 3);
assert_eq!(graph.edge_count(), 0);
sourceimpl<T, A> GenericGraph<T, A>where
A: AdjContainer<T>,
impl<T, A> GenericGraph<T, A>where
A: AdjContainer<T>,
sourcepub fn clear_edges(&mut self)
pub fn clear_edges(&mut self)
removes all edges from the graph
- inexpensive O(1), if there are no edges to begin with
- O(vertices) otherwise
sourcepub fn sort_adj(&mut self)
pub fn sort_adj(&mut self)
Sort adjecency lists
If you depend on the order of the adjecency lists, you can sort them
Performance
- internally uses pattern-defeating quicksort as long as that is the standard
- sorts an adjecency list with length
d
in worst-case:O(d log(d))
- is called for each adjecency list, i.e.,
self.vertex_count()
times
sourcepub fn shuffle_adjs<R: Rng>(&mut self, rng: &mut R)
pub fn shuffle_adjs<R: Rng>(&mut self, rng: &mut R)
Shuffles all adjacency lists
- This will not change the topology. It will change the internal order and thereby randomize the order of the neighbors in the respective iterators
sourcepub fn shuffle_adj<R: Rng>(&mut self, rng: &mut R, index: usize)
pub fn shuffle_adj<R: Rng>(&mut self, rng: &mut R, index: usize)
Shuffles adjacency list
- panics if index is out of bounds
- This will not change the topology. It will change the internal order and thereby randomize the order of the neighbors in the respective iterators
sourcepub fn container(&self, index: usize) -> &A
pub fn container(&self, index: usize) -> &A
get AdjContainer
of vertex index
- panics if index out of bounds
sourcepub fn container_checked(&self, index: usize) -> Option<&A>
pub fn container_checked(&self, index: usize) -> Option<&A>
get AdjContainer
of vertex index
None
if index is out of boundsSome(&A)
else
sourcepub fn container_iter(&self) -> Iter<'_, A>
pub fn container_iter(&self) -> Iter<'_, A>
- get iterator over AdjContainer in order of the indices
- iterator returns
AdjContainer<Node>
sourcepub fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
pub fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
-
iterate over
AdjContainer
of neighbors of vertexindex
-
iterator returns
AdjContainer<Node>
-
sort_adj
will affect the orderIf
let mut iter = self.contained_iter_neighbors()
is called directly afterself.sort_adj()
, the following will be true (as long asiter
does not returnNone
of cause):iter.next().unwrap().id() < iter.next().unwrap.id() < ...
Note, that...id()
returns the index of the corresponding vertex -
panics if index out of bounds
sourcepub fn contained_iter(&self) -> ContainedIter<'_, T, A>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
pub fn contained_iter(&self) -> ContainedIter<'_, T, A>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
- get iterator over additional information stored at each vertex in order of the indices
- iterator returns a
Node
(for exampleEmptyNode
or whatever you used) - similar to
self.container_iter().map(|container| container.contained())
sourcepub fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, A>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
pub fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, A>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
- same as
contained_iter
, but mutable
sourcepub fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
pub fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
- iterate over additional information of neighbors of vertex
index
- iterator returns
&T
sort_adj
will affect the order- panics if index out of bounds
sourcepub fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, A>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
pub fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, A>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
- iterate over additional information of neighbors of vertex
index
- iterator returns (
index_neighbor
,&T
) sort_adj
will affect the order- panics if index out of bounds
sourcepub fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
pub fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, A, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
- iterate over mutable additional information of neighbors of vertex
index
- iterator returns
&mut T
sort_adj
will affect the order- panics if index out of bounds
- See also:
GraphIteratorsMut
sourcepub fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, A>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
pub fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, A>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
- iterate over mutable additional information of neighbors of vertex
index
- iterator returns
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the order- panics if index out of bounds
- See also:
GraphIteratorsMut
sourcepub fn at(&self, index: usize) -> &T
pub fn at(&self, index: usize) -> &T
For your calculations etc.
- read access to your struct T, stored at each vertex, that implements
Node
trait
Note
- panics if index out of bounds
sourcepub fn at_checked(&self, index: usize) -> Option<&T>
pub fn at_checked(&self, index: usize) -> Option<&T>
For your calculations etc.
- read access to your struct T, stored at each vertex, that implements
Node
trait None
if index is out of bounds
sourcepub fn at_mut(&mut self, index: usize) -> &mut T
pub fn at_mut(&mut self, index: usize) -> &mut T
For your calculations etc.
- write access to your struct T, stored at each vertex, that implements
Node
trait
Note
- panics if index out of bounds
sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
returns number of vertices present in graph
sourcepub fn average_degree(&self) -> f32
pub fn average_degree(&self) -> f32
calculates the average degree of the graph
(2 * edge_count) / vertex_count
sourcepub fn get_contained(&self, index: usize) -> Option<&T>
pub fn get_contained(&self, index: usize) -> Option<&T>
Returns a reference to the element stored in the specified node or None
if out of Bounds
sourcepub fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
Returns a mutable reference to the element stored in the specified node or None
if out of Bounds
sourcepub unsafe fn get_contained_unchecked(&self, index: usize) -> &T
pub unsafe fn get_contained_unchecked(&self, index: usize) -> &T
Returns a reference to the element stored in the specified node
For a save alternative see get_contained
Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
sourcepub unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
pub unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
Returns a mutable reference to the element stored in the specified node
For a save alternative see get_contained_mut
Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
sourcepub fn add_edge(
&mut self,
index1: usize,
index2: usize
) -> Result<(), GraphErrors>
pub fn add_edge(
&mut self,
index1: usize,
index2: usize
) -> Result<(), GraphErrors>
Adds edge between nodes index1
and index2
ErrorCases:
Error | Reason |
---|---|
GraphErrors::IndexOutOfRange | index1 or index2 larger than self.vertex_count() |
GraphErrors::EdgeExists | requested edge already exists! |
panics
- if indices out of bounds
- in debug: If
index0 == index1
sourcepub fn remove_edge(
&mut self,
index1: usize,
index2: usize
) -> Result<(), GraphErrors>
pub fn remove_edge(
&mut self,
index1: usize,
index2: usize
) -> Result<(), GraphErrors>
Removes edge between nodes index1 and index2
ErrorCases:
Error | Reason |
---|---|
GraphErrors::IndexOutOfRange | index1 or index2 larger than self.vertex_count() |
GraphErrors::EdgeDoesNotExist | requested edge does not exists |
panics
- if index out of bounds
- in debug: If
index0 == index1
sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
returns total number of edges in graph
sourcepub fn degree(&self, index: usize) -> Option<usize>
pub fn degree(&self, index: usize) -> Option<usize>
- returns number of vertices adjacent to vertex
index
None
if index out of bounds
sourcepub fn degree_iter(&self) -> impl Iterator<Item = usize> + '_
pub fn degree_iter(&self) -> impl Iterator<Item = usize> + '_
Iterator
Iterate over the degrees of each node (in the order of the indices)
sourcepub fn degree_vec(&self) -> Vec<usize>
pub fn degree_vec(&self) -> Vec<usize>
get degree vector
- returns vector of length
self.vertex_count()
where each entry corresponds to the degree of the vertex with the respective index
sourcepub fn degree_histogram(&self) -> HistUsizeFast
pub fn degree_histogram(&self) -> HistUsizeFast
Get a histogram of the degrees
- You can look at your degree distribution with this
Safety
- Assumes you have at least one node, panics otherwise
sourcepub fn dfs(&self, index: usize) -> Dfs<'_, T, A>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
pub fn dfs(&self, index: usize) -> Dfs<'_, T, A>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
returns Iterator
- the iterator will iterate over the vertices in depth first search order,
beginning with vertex
index
. - iterator returns what is contained at the corresponding vertices, i.e.,
&T
- iterator always returns None if index out of bounds
Order
Order is guaranteed to be in DFS order, however if this order is not unambiguous adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn dfs_mut(&mut self, index: usize) -> DfsMut<'_, T, A>ⓘNotable traits for DfsMut<'a, T, A>impl<'a, T, A> Iterator for DfsMut<'a, T, A>where
A: AdjContainer<T> + 'a,
T: 'a, type Item = &'a mut T;
pub fn dfs_mut(&mut self, index: usize) -> DfsMut<'_, T, A>ⓘNotable traits for DfsMut<'a, T, A>impl<'a, T, A> Iterator for DfsMut<'a, T, A>where
A: AdjContainer<T> + 'a,
T: 'a, type Item = &'a mut T;
A: AdjContainer<T> + 'a,
T: 'a, type Item = &'a mut T;
returns Iterator
- the iterator will iterate over the vertices in depth first search order,
beginning with vertex
index
. - iterator returns what is contained at the corresponding vertices, i.e.,
&mut T
- iterator always returns None if index out of bounds
Order
Order is guaranteed to be in DFS order, however if this order is not unambiguous adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, A>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
pub fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, A>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
returns Iterator
- the iterator will iterate over the vertices in depth first search order,
beginning with vertex
index
. - Iterator returns tuple
(index, node)
- iterator always returns None if index out of bounds
Order
Order is guaranteed to be in DFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, A>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
pub fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, A>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
returns Iterator
- the iterator will iterate over the vertices in breadth first search order,
beginning with vertex
index
. - Iterator returns tuple
(index, node, depth)
wherenode
is what is contained at the corresponding index, i.e.,&T
depth
- starts at 0 (i.e. the first element in the iterator will have
depth = 0
) depth
equals number of edges in the shortest path from the current vertex to the first vertex (i.e. to the vertex with indexindex
)
Order
Order is guaranteed to be in BFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn bfs_index_depth_mut(&mut self, index: usize) -> BfsMut<'_, T, A>ⓘNotable traits for BfsMut<'a, T, A>impl<'a, T, A> Iterator for BfsMut<'a, T, A>where
T: 'a,
A: AdjContainer<T> + 'a, type Item = (usize, &'a mut T, usize);
pub fn bfs_index_depth_mut(&mut self, index: usize) -> BfsMut<'_, T, A>ⓘNotable traits for BfsMut<'a, T, A>impl<'a, T, A> Iterator for BfsMut<'a, T, A>where
T: 'a,
A: AdjContainer<T> + 'a, type Item = (usize, &'a mut T, usize);
T: 'a,
A: AdjContainer<T> + 'a, type Item = (usize, &'a mut T, usize);
returns Iterator
- the iterator will iterate over the vertices in breadth first search order,
beginning with vertex
index
. - Iterator returns tuple
(index, node, depth)
wherenode
is what is contained at the corresponding index, i.e.,&mut T
depth
- starts at 0 (i.e. the first element in the iterator will have
depth = 0
) depth
equals number of edges in the shortest path from the current vertex to the first vertex (i.e. to the vertex with indexindex
)
Order
Order is guaranteed to be in BFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn bfs_filtered<F>(
&self,
index: usize,
filter: F
) -> Option<BfsFiltered<'_, T, A>>where
F: FnMut(&T, usize) -> bool,
pub fn bfs_filtered<F>(
&self,
index: usize,
filter: F
) -> Option<BfsFiltered<'_, T, A>>where
F: FnMut(&T, usize) -> bool,
-
similar to self.bfs_index_depth, but allows for ignoring of vertices
-
the iterator will iterate over the vertices in breadth first search order, beginning with vertex
index
. -
the iterator will ignore all vertices, where
filter(vertex, index_of_vertex)
returns false -
returns
None
if index is out of bounds orfilter(vertex, index)
retruns false -
Iterator returns tuple
(index, vertex, depth)
depth
- starts at 0 (i.e. the first element in the iterator will have
depth = 0
) depth
equals number of edges in the shortest path from the current vertex to the first vertex (i.e. to the vertex with indexindex
), while ignoring paths that go through filtered out vertices
Order
Order is guaranteed to be in BFS order, however if this order is not unambigouse adding edges and especially removing edges will shuffle the order.
Note:
Will only iterate over vertices within the connected component that contains vertex index
sourcepub fn is_connected(&self) -> Option<bool>
pub fn is_connected(&self) -> Option<bool>
result | condition |
---|---|
None | if graph does not contain any vertices |
Some(true) | else if all vertices are connected by paths of edges |
Some(false) | otherwise |
sourcepub fn q_core(&self, q: usize) -> Option<usize>
pub fn q_core(&self, q: usize) -> Option<usize>
definition
Calculates the size of the q-core (i.e. number of nodes in the biggest possible set of nodes,
where all nodes from the set are connected with at least q
other nodes from the set)
returns None
if impossible to calculate (e.g. vertex_count == 0
or q <= 1
)
Example
use net_ensembles::EmptyNode;
use net_ensembles::Graph;
let graph: Graph<EmptyNode> = Graph::new(0);
assert_eq!(graph.q_core(1), None);
assert_eq!(graph.q_core(2), None);
let graph2: Graph<EmptyNode> = Graph::new(1);
assert_eq!(graph2.q_core(1), None);
assert_eq!(graph2.q_core(2), Some(0));
// create complete graph
let mut graph3: Graph<EmptyNode> = Graph::new(20);
for i in 0..graph3.vertex_count() {
for j in i+1..graph3.vertex_count() {
graph3.add_edge(i, j).unwrap();
}
}
// since this is a complete graph, the q-core should always consist of 20 nodes
// as long as q < 20, as every node has 19 neighbors
for i in 2..20 {
assert_eq!(graph3.q_core(i), Some(20));
}
assert_eq!(graph3.q_core(20), Some(0));
sourcepub fn connected_components_ids(&self) -> (usize, Vec<isize>)
pub fn connected_components_ids(&self) -> (usize, Vec<isize>)
compute connected component ids
- used for
self.connected_components()
- each vertex gets an id, all vertices with the same id are in the same connected component
- returns (number of components, vector of ids)
sourcepub fn connected_components(&self) -> Vec<usize>
pub fn connected_components(&self) -> Vec<usize>
compute sizes of all connected components
- the number of connected components is the size of the returned vector, i.e.
result.len()
- returns empty vector, if graph does not contain vertices
- returns (reverse) ordered vector of sizes of the connected components,
i.e. the biggest component is of size
result[0]
and the smallest is of sizeresult[result.len() - 1]
sourcepub fn leaf_count(&self) -> usize
pub fn leaf_count(&self) -> usize
Count number of leaves in the graph, i.e. vertices with exactly one neighbor
sourcepub fn to_dot(&self) -> String
👎Deprecated since 0.3.0: Please use any method of the Dot
trait instead, e.g., dot_with_indices
pub fn to_dot(&self) -> String
Dot
trait instead, e.g., dot_with_indices
- Creates String which contains the topology of the network in a format that can be used by circo etc. to generate a pdf of the graph.
- indices are used as labels
- search for graphviz to learn about .dot format
sourcepub fn to_dot_with_labels_from_contained<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: Fn(&T, usize) -> S2,
👎Deprecated since 0.3.0: Please use any method of the DotExtra
trait instead, e.g., dot_from_contained_index
pub fn to_dot_with_labels_from_contained<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: Fn(&T, usize) -> S2,
DotExtra
trait instead, e.g., dot_from_contained_index
Example
use std::fs::File;
use std::io::prelude::*;
use net_ensembles::{Graph, EmptyNode, dot_constants::EXAMPLE_DOT_OPTIONS};
let mut graph: Graph<EmptyNode> = Graph::new(3);
graph.add_edge(0, 1).unwrap();
graph.add_edge(0, 2).unwrap();
graph.add_edge(1, 2).unwrap();
// create string of dotfile
let s = graph.to_dot_with_labels_from_contained(
EXAMPLE_DOT_OPTIONS,
|_contained, index| format!("Hey {}!", index)
);
// write to file
let mut f = File::create("example.dot").expect("Unable to create file");
f.write_all(s.as_bytes()).expect("Unable to write data");
In this example, example.dot
now contains:
graph G{
bgcolor="transparent";
fontsize=50;
node [shape=ellipse, penwidth=1, fontname="Courier", pin=true ];
splines=true;
0 1 2 ;
"0" [label="Hey 0!"];
"1" [label="Hey 1!"];
"2" [label="Hey 2!"];
0 -- 1
0 -- 2
1 -- 2
}
Then you can use, e.g.,
foo@bar:~$ circo example.dot -Tpdf > example.pdf
to create a pdf representation from it. Search for graphviz to learn more.
sourcepub fn to_dot_with_labels_from_container<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: Fn(&A, usize) -> S2,
👎Deprecated since 0.3.0: Please use any method of the DotExtra
trait instead, e.g., dot_from_container_index
pub fn to_dot_with_labels_from_container<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: Fn(&A, usize) -> S2,
DotExtra
trait instead, e.g., dot_from_container_index
Same as to_dot_with_labels_from_contained
but with access to neighbor information
Example
use std::fs::File;
use std::io::prelude::*;
use net_ensembles::traits::*;
use net_ensembles::dot_constants::*;
use net_ensembles::{Graph,EmptyNode};
let mut graph: Graph<EmptyNode> = Graph::new(5);
graph.add_edge(0, 1).unwrap();
graph.add_edge(0, 2).unwrap();
graph.add_edge(1, 2).unwrap();
graph.add_edge(0, 3).unwrap();
graph.add_edge(3, 4).unwrap();
// create string of dotfile
let s = graph.to_dot_with_labels_from_container(
&[SPLINES, NO_OVERLAP].join("\n\t"),
|container, index|
{
container.contained(); // does nothing in this example, but you can still access
// contained, as you could in
// to_dot_with_labels_from_contained
format!("index {}, degree: {}", index, container.degree())
}
);
// write to file
let mut f = File::create("example_2.dot").expect("Unable to create file");
f.write_all(s.as_bytes()).expect("Unable to write data");
In this example, example_2.dot
now contains:
graph G{
splines=true;
overlap=false;
0 1 2 3 4 ;
"0" [label="index 0, degree: 3"];
"1" [label="index 1, degree: 2"];
"2" [label="index 2, degree: 2"];
"3" [label="index 3, degree: 2"];
"4" [label="index 4, degree: 1"];
0 -- 1
0 -- 2
0 -- 3
1 -- 2
3 -- 4
}
Then you can use, e.g.,
foo@bar:~$ circo example_2.dot -Tpdf > example_2.pdf
to create a pdf representation from it. Search for graphviz to learn more.
sourcepub fn diameter(&self) -> Option<usize>
pub fn diameter(&self) -> Option<usize>
- returns
None
if graph not connected or does not contain any vertices - uses repeated breadth first search
sourcepub fn longest_shortest_path_from_index(&self, index: usize) -> Option<usize>
pub fn longest_shortest_path_from_index(&self, index: usize) -> Option<usize>
calculate the size of the longest shortest path starting from vertex with index index
using breadth first search
sourcepub fn vertex_biconnected_components(
self,
alternative_definition: bool
) -> Vec<usize>
pub fn vertex_biconnected_components(
self,
alternative_definition: bool
) -> Vec<usize>
calculate sizes of all binode connected components
- returns (reverse) ordered vector of sizes
i.e. the biggest component is of size
result[0]
and the smallest is of sizeresult[result.len() - 1]
- destroys the underlying topology and therefore moves
self
- if you still need your graph,
use
self.clone().vertex_biconnected_components(false/true)
for your calculations
Definition: vertex_biconnected_components(false)
Here, the (vertex) biconnected component of a graph is defined as maximal subset of nodes, where any one node could be removed and the remaining nodes would still be a connected component.
Note
Two vertices connected by an edge are considered to be biconnected, since after the removal of one vertex (and the corresponding edge), only one vertex remains. This vertex is in a connected component with itself.
Alternative Definition: vertex_biconnected_components(true)
If you want to use the alternative definition:
The biconnected component is defined as maximal subset of vertices, where each vertex can be reached by at least two node independent paths
The alternative definition just removes all 2s from the result vector.
Citations
I used the algorithm described in this paper:
J. Hobcroft and R. Tarjan, “Algorithm 447: Efficient Algorithms for Graph Manipulation” Commun. ACM, 16:372-378, 1973, DOI: 10.1145/362248.362272
You can also take a look at:
M. E. J. Newman, “Networks: an Introduction” Oxfort University Press, 2010, ISBN: 978-0-19-920665-0.
sourcepub fn vertex_load(&self, include_endpoints: bool) -> Vec<f64>
pub fn vertex_load(&self, include_endpoints: bool) -> Vec<f64>
Closely related (most of the time equal) to betweeness
calculates vertex_load of all vertices in O(edges * vertices)
- calculates the vertex_load for every vertex
- defined as how many shortest paths pass through each vertex
variant | |
---|---|
vertex_load(true) | includes endpoints in calculation (for a complete graph with N vertices, every node will have vertex_load N - 1 ) |
vertex_load(false) | excludes endpoints in calculation (for a complete graph with N vertices, every node will have vertex_load 0 ) |
Citations
I used the algorithm described in
M. E. J. Newman, “Scientific collaboration networks. II. Shortest paths, weighted networks, and centrality”, Phys. Rev. E 64, 016132, 2001, DOI: 10.1103/PhysRevE.64.016132
see also:
M. E. J. Newman, “Erratum: Scientific collaboration networks. II. Shortest paths, weighted networks, and centrality”, Phys. Rev. E 73, 039906, 2006, DOI: 10.1103/PhysRevE.73.039906
pub fn closeness_centrality(&self) -> Vec<f64>
sourcepub fn transitivity(&self) -> f64
pub fn transitivity(&self) -> f64
Calculates transitivity of graph
- related to cluster coefficient (Note: transitivity and cluster coefficient are similar, but not necessarily equal)
- returns
NaN
, if there are no paths of length two in the graph
Definition
transitivity = (number of closed paths of length two) / (number of paths of length two)
Citations
For the definition see for example:
M. E. J. Newman, “Networks: an Introduction” Oxfort University Press, 2010, ISBN: 978-0-19-920665-0.
sourcepub fn cloned_subgraph(&self, node_list: Vec<usize>) -> Option<Graph<T>>where
T: Clone,
pub fn cloned_subgraph(&self, node_list: Vec<usize>) -> Option<Graph<T>>where
T: Clone,
Create a subgraph
Method to create a subgraph. node_list
should contain all the indices
corresponding to the nodes you want to keep, the order of the indices is
irrelevant. Duplicate indices will be ignored.
If any index is out of bounds (or node_list
is empty), None
will be returned
All edges between nodes that are inside the node_list
will be kept.
All other edges will be discarded.
The nodes in the subgraph will get new indices corresponding to their new position.
The contained information (T
) will be cloned.
Note
The container used will be changed to a NodeContainer, since I cannot guarantee that other container would make sense here. E.g., if you used a SwContainer the information about the root edges might become invalid, because the corresponding nodes might not be part of the subgraph
sourceimpl<T> GenericGraph<T, NodeContainer<T>>where
T: Node,
impl<T> GenericGraph<T, NodeContainer<T>>where
T: Node,
sourcepub fn complete_graph(n: usize) -> Self
pub fn complete_graph(n: usize) -> Self
Efficiently create a complete graph with n nodes
sourceimpl<T> GenericGraph<T, SwContainer<T>>where
T: Node + SerdeStateConform,
impl<T> GenericGraph<T, SwContainer<T>>where
T: Node + SerdeStateConform,
sourcepub fn reset_edge(&mut self, index0: usize, index1: usize) -> SwChangeState
pub fn reset_edge(&mut self, index0: usize, index1: usize) -> SwChangeState
Reset small-world edge to its root state
- panics if index out of bounds
- in debug: panics if
index0 == index1
sourcepub fn rewire_edge(
&mut self,
index0: usize,
index1: usize,
index2: usize
) -> SwChangeState
pub fn rewire_edge(
&mut self,
index0: usize,
index1: usize,
index2: usize
) -> SwChangeState
Rewire edges
- rewire edge
(index0, index1)
to(index0, index2)
panics
- if indices are out of bounds
- in debug: panics if
index0 == index2
- edge
(index0, index1)
has to be rooted atindex0
, else will panic in debug mode
sourcepub fn count_nodes_with_long_ranging_edges(&self) -> usize
pub fn count_nodes_with_long_ranging_edges(&self) -> usize
How many nodes have long ranging edges?
- counts how many nodes have long ranging edges
- A long ranging edge is defined as an edge, where is_at_root returns true, i.e., which is not in ist original ring configuration
sourcepub fn frac_nodes_wlre(&self) -> f64
pub fn frac_nodes_wlre(&self) -> f64
Fraction of nodes which have long ranging edges
- A long ranging edge is defined as an edge, where is_at_root returns true, i.e., which is not in ist original ring configuration
sourcepub fn count_long_ranging_edges(&self) -> usize
pub fn count_long_ranging_edges(&self) -> usize
How many long ranging edges are there in the Graph?
- A long ranging edge is defined as an edge, where is_at_root returns true, i.e., which is not in ist original ring configuration
sourcepub fn frac_long_ranging_edges(&self) -> f64
pub fn frac_long_ranging_edges(&self) -> f64
Fraction of long ranging edges in the Graph?
- A long ranging edge is defined as an edge, where is_at_root returns false, i.e., which is not in ist original ring configuration
- this is: #longranging/#total
sourceimpl<T> GenericGraph<T, SpacialNodeContainer<T>>
impl<T> GenericGraph<T, SpacialNodeContainer<T>>
sourcepub fn distance(&self, i: usize, j: usize) -> Option<f64>where
SpacialNodeContainer<T>: AdjContainer<T>,
pub fn distance(&self, i: usize, j: usize) -> Option<f64>where
SpacialNodeContainer<T>: AdjContainer<T>,
Euclidean distance between two vertices
- Calculates the distance between the vertices
corresponding to the indices
i
andj
None
if any of the indices is out of bounds
Trait Implementations
sourceimpl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
impl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
impl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
sourceimpl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node,
R: Rng,
impl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node,
R: Rng,
impl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> AsRef<GenericGraph<T, SpacialNodeContainer<T>>> for SpacialEnsemble<T, R>
impl<T, R> AsRef<GenericGraph<T, SpacialNodeContainer<T>>> for SpacialEnsemble<T, R>
sourcefn as_ref(&self) -> &SpacialGraph<T>
fn as_ref(&self) -> &SpacialGraph<T>
sourceimpl<T, R> AsRef<GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node,
R: Rng,
impl<T, R> AsRef<GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> AsRef<GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
impl<T, R> AsRef<GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
sourceimpl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
impl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
impl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
sourceimpl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node,
R: Rng,
impl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node,
R: Rng,
impl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> Borrow<GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node,
R: Rng,
impl<T, R> Borrow<GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T: Clone, A: Clone> Clone for GenericGraph<T, A>
impl<T: Clone, A: Clone> Clone for GenericGraph<T, A>
sourcefn clone(&self) -> GenericGraph<T, A>
fn clone(&self) -> GenericGraph<T, A>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<T: Debug, A: Debug> Debug for GenericGraph<T, A>
impl<T: Debug, A: Debug> Debug for GenericGraph<T, A>
sourceimpl<'de, T, A> Deserialize<'de> for GenericGraph<T, A>where
A: Deserialize<'de>,
impl<'de, T, A> Deserialize<'de> for GenericGraph<T, A>where
A: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl<T, A> Dot for GenericGraph<T, A>where
T: Node,
A: AdjContainer<T>,
impl<T, A> Dot for GenericGraph<T, A>where
T: Node,
A: AdjContainer<T>,
sourcefn dot_from_indices<F, W, S1, S2>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
W: Write,
F: FnMut(usize) -> S2,
fn dot_from_indices<F, W, S1, S2>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
W: Write,
F: FnMut(usize) -> S2,
f
to create labels depending on the indexdot_options
use dot_options!
macro and take a look at module dot_constants
sourcefn dot_string_from_indices<F, S1, S2>(&self, dot_options: S1, f: F) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize) -> S2,
fn dot_string_from_indices<F, S1, S2>(&self, dot_options: S1, f: F) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize) -> S2,
self.dot_from_indices
but returns String insteadsourcefn dot_with_indices<S, W>(&self, writer: W, dot_options: S) -> Result<(), Error>where
S: AsRef<str>,
W: Write,
fn dot_with_indices<S, W>(&self, writer: W, dot_options: S) -> Result<(), Error>where
S: AsRef<str>,
W: Write,
sourcefn dot_string_with_indices<S>(&self, dot_options: S) -> Stringwhere
S: AsRef<str>,
fn dot_string_with_indices<S>(&self, dot_options: S) -> Stringwhere
S: AsRef<str>,
self.dot_with_indices
but returns String insteadsourcefn dot<S, W>(&self, writer: W, dot_options: S) -> Result<(), Error>where
S: AsRef<str>,
W: Write,
fn dot<S, W>(&self, writer: W, dot_options: S) -> Result<(), Error>where
S: AsRef<str>,
W: Write,
sourcefn dot_string<S>(&self, dot_options: S) -> Stringwhere
S: AsRef<str>,
fn dot_string<S>(&self, dot_options: S) -> Stringwhere
S: AsRef<str>,
self.dot()
, but returns a String insteadsourceimpl<T, A> DotExtra<T, A> for GenericGraph<T, A>where
A: AdjContainer<T>,
impl<T, A> DotExtra<T, A> for GenericGraph<T, A>where
A: AdjContainer<T>,
sourcefn dot_from_container_index<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &A) -> S2,
W: Write,
fn dot_from_container_index<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &A) -> S2,
W: Write,
A
(usually stored at each
index) to create the lablessourcefn dot_from_contained_index<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
W: Write,
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &T) -> S2,
fn dot_from_contained_index<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
W: Write,
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &T) -> S2,
T
(usually something contained in A
(see dot_from_container
)
and stored at each vertex) to create the lablessourcefn dot_string_from_container_index<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &A) -> S2,
fn dot_string_from_container_index<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &A) -> S2,
self.dot_string_from_container_index
but returns String insteadsourcefn dot_from_container<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&A) -> S2,
W: Write,
fn dot_from_container<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&A) -> S2,
W: Write,
A
(usually stored at each
index) to create the lablessourcefn dot_string_from_container<F, S1, S2>(&self, dot_options: S1, f: F) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&A) -> S2,
fn dot_string_from_container<F, S1, S2>(&self, dot_options: S1, f: F) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&A) -> S2,
self.dot_from_container
but returns String insteadsourcefn dot_string_from_contained_index<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &T) -> S2,
fn dot_string_from_contained_index<F, S1, S2>(
&self,
dot_options: S1,
f: F
) -> Stringwhere
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(usize, &T) -> S2,
self.dot_from_contained
but returns String insteadsourcefn dot_from_contained<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
W: Write,
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&T) -> S2,
fn dot_from_contained<F, S1, S2, W>(
&self,
writer: W,
dot_options: S1,
f: F
) -> Result<(), Error>where
W: Write,
S1: AsRef<str>,
S2: AsRef<str>,
F: FnMut(&T) -> S2,
T
(usually something contained in A
(see dot_from_container
)
and stored at each vertex) to create the lablessourceimpl<T: Node, A: AdjContainer<T>> From<&GenericGraph<T, A>> for Graph<T>
impl<T: Node, A: AdjContainer<T>> From<&GenericGraph<T, A>> for Graph<T>
sourcefn from(source: &GenericGraph<T, A>) -> Self
fn from(source: &GenericGraph<T, A>) -> Self
sourceimpl<T, E> GraphIterators<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for Ewhere
T: Node,
E: WithGraph<T, GenericGraph<T, NodeContainer<T>>>,
impl<T, E> GraphIterators<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for Ewhere
T: Node,
E: WithGraph<T, GenericGraph<T, NodeContainer<T>>>,
sourcefn contained_iter(&self) -> ContainedIter<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
fn contained_iter(&self) -> ContainedIter<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
Node
(for example EmptyNode
or whatever you used)self.container_iter().map(|container| container.contained())
sourcefn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
index
&T
sort_adj
will affect the ordersourcefn container_iter(&self) -> Iter<'_, NodeContainer<T>>
fn container_iter(&self) -> Iter<'_, NodeContainer<T>>
AdjContainer<Node>
, i.e., A
sourcefn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
index
&T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, NodeContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, NodeContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
index
index_neighbor
,&T
)sort_adj
will affect the ordersourcefn dfs(&self, index: usize) -> Dfs<'_, T, NodeContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
fn dfs(&self, index: usize) -> Dfs<'_, T, NodeContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
Iterator
Read moresourcefn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, NodeContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, NodeContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
Iterator
Read moresourcefn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, NodeContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, NodeContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
Iterator
Read moresourceimpl<T, E> GraphIterators<T, GenericGraph<T, SwContainer<T>>, SwContainer<T>> for Ewhere
T: Node,
E: WithGraph<T, GenericGraph<T, SwContainer<T>>>,
impl<T, E> GraphIterators<T, GenericGraph<T, SwContainer<T>>, SwContainer<T>> for Ewhere
T: Node,
E: WithGraph<T, GenericGraph<T, SwContainer<T>>>,
sourcefn contained_iter(&self) -> ContainedIter<'_, T, SwContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
fn contained_iter(&self) -> ContainedIter<'_, T, SwContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
Node
(for example EmptyNode
or whatever you used)self.container_iter().map(|container| container.contained())
sourcefn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
index
&T
sort_adj
will affect the ordersourcefn container_iter(&self) -> Iter<'_, SwContainer<T>>
fn container_iter(&self) -> Iter<'_, SwContainer<T>>
AdjContainer<Node>
, i.e., A
sourcefn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
index
&T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, SwContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, SwContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
index
index_neighbor
,&T
)sort_adj
will affect the ordersourcefn dfs(&self, index: usize) -> Dfs<'_, T, SwContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
fn dfs(&self, index: usize) -> Dfs<'_, T, SwContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
Iterator
Read moresourcefn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, SwContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, SwContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
Iterator
Read moresourcefn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, SwContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, SwContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
Iterator
Read moresourceimpl<T, R> GraphIterators<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIterators<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter(&self) -> ContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
fn contained_iter(&self) -> ContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
Node
(for example EmptyNode
or whatever you used)self.container_iter().map(|container| container.contained())
sourcefn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
index
&T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
index
index_neighbor
,&T
)sort_adj
will affect the ordersourcefn container_iter(&self) -> Iter<'_, WSContainer<T>>
fn container_iter(&self) -> Iter<'_, WSContainer<T>>
AdjContainer<Node>
, i.e., A
sourcefn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
index
&T
sort_adj
will affect the ordersourcefn dfs(&self, index: usize) -> Dfs<'_, T, WSContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
fn dfs(&self, index: usize) -> Dfs<'_, T, WSContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
Iterator
Read moresourcefn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, WSContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, WSContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
Iterator
Read moresourcefn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, WSContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, WSContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
Iterator
Read moresourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ConfigurationModel<T, R>where
T: Node,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ConfigurationModel<T, R>where
T: Node,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ErEnsembleC<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ErEnsembleC<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ErEnsembleM<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for ErEnsembleM<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, NodeContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, SwContainer<T>>, SwContainer<T>> for SwEnsemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, SwContainer<T>>, SwContainer<T>> for SwEnsemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, SwContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, SwContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, SwContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, SwContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, SwContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, A, E> MeasurableGraphQuantities<GenericGraph<T, A>> for Ewhere
T: Node,
A: AdjContainer<T>,
GenericGraph<T, A>: Clone,
E: AsRef<GenericGraph<T, A>>,
impl<T, A, E> MeasurableGraphQuantities<GenericGraph<T, A>> for Ewhere
T: Node,
A: AdjContainer<T>,
GenericGraph<T, A>: Clone,
E: AsRef<GenericGraph<T, A>>,
sourcefn average_degree(&self) -> f32
fn average_degree(&self) -> f32
sourcefn connected_components(&self) -> Vec<usize>
fn connected_components(&self) -> Vec<usize>
sourcefn diameter(&self) -> Option<usize>
fn diameter(&self) -> Option<usize>
None
if graph not connected or does not contain any verticessourcefn edge_count(&self) -> usize
fn edge_count(&self) -> usize
sourcefn is_connected(&self) -> Option<bool>
fn is_connected(&self) -> Option<bool>
sourcefn leaf_count(&self) -> usize
fn leaf_count(&self) -> usize
sourcefn longest_shortest_path_from_index(&self, index: usize) -> Option<usize>
fn longest_shortest_path_from_index(&self, index: usize) -> Option<usize>
index
using breadth first search Read moresourcefn transitivity(&self) -> f64
fn transitivity(&self) -> f64
sourcefn vertex_biconnected_components(
&self,
alternative_definition: bool
) -> Vec<usize>
fn vertex_biconnected_components(
&self,
alternative_definition: bool
) -> Vec<usize>
sourcefn vertex_count(&self) -> usize
fn vertex_count(&self) -> usize
sourceimpl<T, A> Serialize for GenericGraph<T, A>where
A: Serialize,
impl<T, A> Serialize for GenericGraph<T, A>where
A: Serialize,
sourceimpl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourceimpl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
impl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ConfigurationModel<T, R>where
T: Node,
sourcefn sort_adj(&mut self)
fn sort_adj(&mut self)
Sort adjecency lists
If you depend on the order of the adjecency lists, you can sort them
Performance
- internally uses pattern-defeating quicksort as long as that is the standard
- sorts an adjecency list with length
d
in worst-case:O(d log(d))
- is called for each adjecency list, i.e.,
self.vertex_count()
times
sourceimpl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ErEnsembleC<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn sort_adj(&mut self)
fn sort_adj(&mut self)
Sort adjecency lists
If you depend on the order of the adjecency lists, you can sort them
Performance
- internally uses pattern-defeating quicksort as long as that is the standard
- sorts an adjecency list with length
d
in worst-case:O(d log(d))
- is called for each adjecency list, i.e.,
self.vertex_count()
times
sourceimpl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for ErEnsembleM<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn sort_adj(&mut self)
fn sort_adj(&mut self)
Sort adjecency lists
If you depend on the order of the adjecency lists, you can sort them
Performance
- internally uses pattern-defeating quicksort as long as that is the standard
- sorts an adjecency list with length
d
in worst-case:O(d log(d))
- is called for each adjecency list, i.e.,
self.vertex_count()
times
sourceimpl<T, R> WithGraph<T, GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> WithGraph<T, GenericGraph<T, SwContainer<T>>> for SwEnsemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn sort_adj(&mut self)
fn sort_adj(&mut self)
Sort adjecency lists
If you depend on the order of the adjecency lists, you can sort them
Performance
- internally uses pattern-defeating quicksort as long as that is the standard
- sorts an adjecency list with length
d
in worst-case:O(d log(d))
- is called for each adjecency list, i.e.,
self.vertex_count()
times