Struct SubGraph

Source
pub struct SubGraph { /* private fields */ }
Expand description

| all functions here assume the given | node ids are proper ones from 0 to n-1 | so, the caller must use |

Implementations§

Source§

impl SubGraph

Source

pub fn new_from_graph_hash_ref<GH>(gh: &GH, name: &str) -> Self

QUESTION: why is this impl different from &Graph

Source

pub fn new_from_graph_ref<G>(g: &G, name: &str) -> Self

QUESTION: why is this impl different from &GraphHash

Source§

impl SubGraph

Source

pub fn debug_without_nodes<'g>(&'g self) -> SubGraphDebugger<'g>

Source

pub fn debug_with_nodes<'g>(&'g self) -> SubGraphDebugger<'g>

Source§

impl SubGraph

Source

pub fn stack_push(&mut self, n: NodeId)

Source

pub fn stack_pop(&mut self) -> Option<NodeId>

Source

pub fn stack_len(&self) -> usize

Source

pub fn stack_node_at_index(&self, idx: usize) -> NodeId

Source

pub fn stack_set_node_at_index(&mut self, idx: usize, n: NodeId)

Source§

impl SubGraph

Source

pub fn queue_len(&self) -> usize

Source

pub fn enqueue(&mut self, n: NodeId)

Source

pub fn dequeue(&mut self) -> Option<NodeId>

Source§

impl SubGraph

Source

pub fn clear_parents(&mut self)

Source

pub fn clear_node_parents(&mut self, node: NodeId)

Source

pub fn parents_for_node(&self, v_n: NodeId) -> Vec<NodeId>

Source

pub fn num_parents_for_node(&self, v_n: NodeId) -> usize

Source

pub fn set_single_parent(&mut self, node: NodeId, parent: NodeId)

Source

pub fn set_parents_for_node(&mut self, node: NodeId, parents: Vec<NodeId>)

Source

pub fn has_parent(&self, node: NodeId, candidate: NodeId) -> bool

Source

pub fn add_parent(&mut self, node: NodeId, parent: NodeId)

Source

pub fn reinit_parents(&mut self, len: usize)

Source

pub fn fill_to_len(&mut self, len: usize, val: Vec<NodeId>)

Source§

impl SubGraph

Source

pub fn visited(&self, id: NodeId) -> bool

Source

pub fn unvisited(&self, id: NodeId) -> bool

Source

pub fn visit(&mut self, id: NodeId)

Source

pub fn unvisit(&mut self, id: NodeId)

Source

pub fn reinit_visit_markers(&mut self, len: usize)

Source

pub fn fill_visit_markers(&mut self, val: bool)

Source

pub fn fill_visit_markers_to_len(&mut self, len: usize, val: bool)

Source§

impl SubGraph

Source

pub fn label_map_clear(&mut self)

Source

pub fn label_map_inout(&self, node: NodeId) -> NodeId

Source

pub fn label_map_outin(&self, node: NodeId) -> NodeId

Source

pub fn label_map_mapped_edge(&self, theirs: &Edge) -> Edge

Source

pub fn label_map_projected_edge(&self, mine: &Edge) -> Edge

Source

pub fn label_map_insert_outin(&mut self, src: NodeId, dst: NodeId)

Source

pub fn label_map_resize_inout(&mut self, len: usize, default: NodeId)

Source§

impl SubGraph

Source

pub fn distance_is_farther_away(&self, x: NodeId, y: NodeId) -> bool

Source

pub fn distance_is_farther_than_one_away(&self, x: NodeId, y: NodeId) -> bool

Source

pub fn distance_is_one_step_away(&self, x: NodeId, y: NodeId) -> bool

Source

pub fn distance_is_infinite(&self, node: NodeId) -> bool

Source

pub fn distance(&self, node: NodeId) -> f64

Source

pub fn set_distance_for_node(&mut self, node: NodeId, val: f64)

Source

pub fn set_distance_one_step_away(&mut self, dst: NodeId, src: NodeId)

Source

pub fn set_distance_zero(&mut self, source: NodeId)

Source

pub fn distance_reinit(&mut self, len: usize)

Source§

impl SubGraph

Source

pub fn sigma_update(&mut self, v_p: NodeId, v_n: NodeId, sp_sn: f64)

Source

pub fn sigma_set_node_to_zero(&mut self, node: NodeId)

Source

pub fn sigma_set_node_to_one(&mut self, node: NodeId)

Source

pub fn increment_sigma_value_for_node(&mut self, v_n: NodeId, c_t: f64)

Source

pub fn reinit_sigmas(&mut self, len: usize)

Source

pub fn sigma_ratio(&self, v_p: NodeId, v_n: NodeId) -> f64

Source

pub fn fill_sigmas(&mut self, val: f64)

Source§

impl SubGraph

Source

pub fn new_sigmas_sigma_update(&mut self, v_p: NodeId, v_n: NodeId, sp_sn: f64)

Source

pub fn new_sigmas_sigma_set_node_to_zero(&mut self, node: NodeId)

Source

pub fn new_sigmas_sigma_set_node_to_one(&mut self, node: NodeId)

Source

pub fn new_sigmas_sigma_value_for_node(&self, node: NodeId) -> f64

Source

pub fn new_sigmas_set_sigma_value_for_node(&mut self, node: NodeId, val: f64)

Source

pub fn new_sigmas_increment_sigma_value_for_node( &mut self, v_n: NodeId, c_t: f64, )

Source

pub fn reinit_new_sigmas(&mut self, len: usize)

Source

pub fn new_sigmas_sigma_ratio(&self, v_p: NodeId, v_n: NodeId) -> f64

Source

pub fn new_sigmas_fill_sigmas(&mut self, val: f64)

Source§

impl SubGraph

Source

pub fn pair_dependency_for_node(&self, node: NodeId) -> f64

Source

pub fn set_pair_dependency_for_node(&mut self, node: NodeId, val: f64)

Source

pub fn reinit_pair_dependencies(&mut self, len: usize)

Source

pub fn increment_pair_dependency_for_node(&mut self, node: NodeId, val: f64)

Source§

impl SubGraph

Source§

impl SubGraph

Source

pub fn increment_path_count_for_node(&mut self, node: NodeId, val: usize)

Source

pub fn increment_path_count_for_node_from( &mut self, node: NodeId, other: NodeId, )

Source

pub fn update_path_counts(&mut self, dst: NodeId, src: NodeId)

Source

pub fn path_count_for_node(&self, node: NodeId) -> usize

Source

pub fn set_path_count_for_node(&mut self, node: NodeId, count: usize)

Source

pub fn path_count_ratio(&self, v_p: NodeId, v_n: NodeId) -> f64

Source

pub fn set_path_count_to_one(&mut self, source: NodeId)

Source

pub fn set_path_count_to_zero(&mut self, source: NodeId)

Source

pub fn path_counts_reinit(&mut self, len: usize)

Source§

impl SubGraph

Source§

impl SubGraph

Source§

impl SubGraph

Source

pub fn nodeid_range(&self) -> Vec<NodeId>

Source

pub fn limited_nodeid_range(&self, cap: Option<usize>) -> Vec<NodeId>

Source

pub fn mapped_nodes(&self) -> Vec<NodeId>

Source

pub fn set_neighbors(&mut self, node: NodeId, nbrs: Vec<NodeId>)

Source

pub fn add_neighbor(&mut self, node: NodeId, nbr: NodeId)

Source

pub fn has_map_for_node(&self, node: NodeId) -> bool

Source

pub fn remove_node_and_neighbors(&mut self, node: NodeId)

Source

pub fn neighbors(&self, node: NodeId) -> Neighbors

Source

pub fn extend_mapped_nodes(&mut self, other: &NeighborsMap)

Source

pub fn nodes_map_add_edge(&mut self, e: &Edge)

Source

pub fn nodes_map_reinit(&mut self, len: usize)

Source

pub fn nodes_map_clear(&mut self)

Source

pub fn nodes_map_add_isolated_node(&mut self, node: NodeId)

Source

pub fn num_edges(&self) -> usize

Source

pub fn clear_edges(&mut self)

Source

pub fn has_edge(&self, edge: &Edge) -> bool

Source

pub fn connects(&self, src: NodeId, dst: NodeId) -> bool

Source

pub fn edges_to_node(&self, src: NodeId) -> Vec<Edge>

Source

pub fn edges_from_node(&self, src: NodeId) -> Vec<Edge>

Source

pub fn iteration1_build_stack( &mut self, src: NodeId, dst: NodeId, stack: &mut Stack<NodeId>, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_build_stack( &mut self, s: NodeId, stack: &mut Vec<NodeId>, ) -> Result<(), BetweennessCentralityError>

Source

pub fn init_iteration1(&mut self, source: NodeId)

Source

pub fn iteration1_step1_process_nodes( &mut self, v_i: NodeId, stack: &mut Stack<NodeId>, src: NodeId, dst: NodeId, )

Source

pub fn iteration1_fill_stack( &mut self, stack: &mut Stack<NodeId>, src: NodeId, dst: NodeId, ) -> Result<(), BetweennessCentralityError>

Source

pub fn init_iteration2(&mut self, source: NodeId)

Source

pub fn adjust_stack(&self, stack: &mut Vec<NodeId>)

Source

pub fn resize_pair_dependencies_and_sigma_based_on_map_len(&mut self)

Source

pub fn iteration2_update1( &mut self, stack: &mut Vec<NodeId>, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_update2_process_neighbor(&mut self, v: NodeId, nbr: NodeId)

Source

pub fn iteration2_update2(&mut self) -> Result<(), BetweennessCentralityError>

Source

pub fn bfs_maybe_visit(&mut self, node: NodeId)

Source

pub fn maybe_augment_bc_value_for_node( &self, source: NodeId, v_n: NodeId, scores: &mut BetweennessScores, )

Source

pub fn maybe_attenuate_bc_value_for_node( &self, source: NodeId, v_n: NodeId, scores: &mut BetweennessScores, )

Source

pub fn maybe_attenuate_bc_value_for_node_using_vertex_map<GH: NumNodes>( &self, source: NodeId, v_n: NodeId, scores: &mut BetweennessScores, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, )

Source

pub fn maybe_augment_bc_value_for_node_using_vertex_map<GH: NumNodes>( &self, source: NodeId, v_n: NodeId, scores: &mut BetweennessScores, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, )

Source

pub fn rbfs1_to_add_the_new_pair_dependencies_step<GH: NumNodes>( &mut self, v_n: NodeId, source: NodeId, stack: &Vec<NodeId>, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source

pub fn rbfs1_to_add_the_new_pair_dependencies<GH: NumNodes>( &mut self, source: NodeId, stack: &Vec<NodeId>, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, ) -> Result<(), BetweennessCentralityError>

Source

pub fn rbfs2_to_add_the_new_pair_dependencies_step<GH: NumNodes>( &mut self, v_n: NodeId, source: NodeId, stack: &Vec<NodeId>, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, ) -> Result<(), BetweennessCentralityError>

Source

pub fn rbfs2_to_add_the_new_pair_dependencies<GH: NumNodes>( &mut self, source: NodeId, stack: &Vec<NodeId>, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source

pub fn src_dist_is_greater_than_dst_plus_one( &self, src: NodeId, dst: NodeId, ) -> bool

Source

pub fn src_dist_equals_dst_plus_one(&self, src: NodeId, dst: NodeId) -> bool

Source

pub fn iteration_2<GH: NumNodes>( &mut self, tmp_subgraph_map: &SubGraphMap<GH>, tmp_conn_vertex_map: &ConnVertexMap, source: NodeId, src: NodeId, dst: NodeId, src_distance: f64, dst_distance: f64, scores: &mut BetweennessScores, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_step3_when_src_dist_is_greater_than_dst_plus_one( &mut self, w: NodeId, v: NodeId, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_step3_when_src_dist_equals_dst_plus_one( &mut self, w: NodeId, v: NodeId, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_step3_process_neighbor( &mut self, v: NodeId, nbr: NodeId, ) -> Result<(), BetweennessCentralityError>

Source

pub fn iteration2_step3_process(&mut self, v: NodeId)

Source

pub fn iteration2_step3(&mut self)

Trait Implementations§

Source§

impl BfsFromSource for SubGraph

Source§

fn do_bfs_from_source_count_vertices_and_mark_visited( &self, source: NodeId, visit_markers: &mut VisitMarkers, out_vec: &mut Vec<i32>, ) -> Result<(), BetweennessCentralityError>

do a BFS from s, count the number of vertices, and mark the visited

Source§

impl Clear for SubGraph

Source§

fn clear(&mut self)

Source§

impl ComputeNewPathCountsAndPaths for SubGraph

Source§

impl CreateDistanceMaps for SubGraph

Source§

impl CreateNamedEmpty for SubGraph

Source§

fn empty(name: &str) -> Self

Source§

impl Debug for SubGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FindPruningCounts for SubGraph

Source§

impl FindSingleSourceShortestPaths for SubGraph

Source§

impl GetConnectedComponentSizes for SubGraph

Source§

fn conn_comp_sizes(&self) -> Result<Vec<i32>, BetweennessCentralityError>

| the vector @out_vec will have sizes | of the connected components in the graph |

Source§

impl GetEdges for SubGraph

Source§

fn edges(&self) -> &Edges

Source§

impl GetNeighborsForNode for SubGraph

Source§

fn neighbors(&self, node: NodeId) -> Neighbors

Source§

impl GetNodes for SubGraph

Source§

impl GetSigmaValueForNode for SubGraph

Source§

impl InsertEdge for SubGraph

Source§

impl InsertEdgeBetweenNodes for SubGraph

Source§

impl MucAttenuate for SubGraph

Source§

fn muc_attenuate_no_new( &mut self, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl MucAttenuateParent for SubGraph

Source§

fn muc_attenuate_parent_no_new( &mut self, parent: NodeId, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl MucAugment for SubGraph

Source§

fn muc_augment_no_new( &mut self, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl MucAugmentParent for SubGraph

Source§

fn muc_augment_parent_no_new( &mut self, parent: NodeId, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl MucComputeNewPathCountsAndPaths for SubGraph

Source§

impl MucUpdate for SubGraph

Source§

fn muc_update( &mut self, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl MucUpdateParent for SubGraph

Source§

fn muc_update_parent( &mut self, parent: NodeId, v_n: NodeId, source: NodeId, tmp_conn_vertex_map: &ConnVertexMap, scores: &mut BetweennessScores, )

Source§

impl Named for SubGraph

Source§

fn name(&self) -> Cow<'_, str>

Returns the name associated with self. We use Cow to allow both owned and borrowed strings.
Source§

impl NumNodes for SubGraph

Source§

impl ReinitMaps for SubGraph

Source§

fn reinit_maps(&mut self)

Source§

impl RemoveEdgeBetweenNodes for SubGraph

Source§

impl<G: NumNodes + GetNodeIdRange + GetNeighborsForNode + GetEdges> ResetWith<G> for SubGraph

Source§

fn reset_with(&mut self, g: &G)

Source§

impl SetSigmaValueForNode for SubGraph

Source§

fn set_sigma_value_for_node(&mut self, node: NodeId, val: f64)

Source§

impl UpdatePairDependencies for SubGraph

Source§

impl UpdateSigmas for SubGraph

Source§

fn maybe_update_all_sigmas<GH: NumNodes>( &mut self, v_n: NodeId, source: NodeId, subgraph_map: &SubGraphMap<GH>, conn_vertex_map: &ConnVertexMap, ) -> Result<(), BetweennessCentralityError>

Source§

fn maybe_update_all_sigmas_and_do_new<GH: NumNodes>( &mut self, v_n: NodeId, source: NodeId, subgraph_map: &SubGraphMap<GH>, conn_vertex_map: &ConnVertexMap, ) -> Result<(), BetweennessCentralityError>

Source§

fn update_all_sigmas(&mut self, v_p: NodeId, v_n: NodeId)

Source§

fn update_new_sigmas(&mut self, v_p: NodeId, v_n: NodeId)

Source§

fn update_sigmas(&mut self, v_p: NodeId, v_n: NodeId)

Source§

impl UpdateWithSrcDst for SubGraph

Source§

fn update(&mut self, src: NodeId, dst: NodeId)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> FindBiconnectedComponent for T

Source§

fn find_bicon_component<GH>(&mut self, out_vec: &mut Vec<GH>)

Source§

impl<T> FindEdgeBccSubgraph for T

Source§

fn find_edge_bcc_subgraph<GH>( &mut self, bcc: &mut GH, edge: &Edge, ) -> Result<(), BetweennessCentralityError>

| the edge (@src, @dst) must be in the graph | the biconnected component subgraph that | contains the passed edge will be returned | in @bcc | | IMP assumption: | | the input graph is connected, and the edge | (src, dst) is inserted, so the edge (src, | dst) is part of a cycle, so both ends | belong to the same bcc | |IMP: (src,dst) must exist!

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PoisonMessage for T
where T: Debug,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more