vg
tools for working with variation graphs
Public Member Functions | Public Attributes | Private Attributes | List of all members
vg::SparseUnionFind Class Reference

#include <sparse_union_find.hpp>

Inheritance diagram for vg::SparseUnionFind:

Public Member Functions

 SparseUnionFind (bool include_children, vector< size_t > node_ids)
 
 ~SparseUnionFind ()
 Destructor. More...
 
size_t size ()
 Returns the number of indices in the UnionFind. More...
 
size_t find_group (size_t i)
 Returns the group ID that index i belongs to (can change after calling union) More...
 
void union_groups (size_t i, size_t j)
 Merges the group containing index i with the group containing index j. More...
 
size_t group_size (size_t i)
 Returns the size of the group containing index i. More...
 
vector< size_t > group (size_t i)
 Returns a vector of the indices in the same group as index i. More...
 
vector< vector< size_t > > all_groups ()
 Returns all of the groups, each in a separate vector. More...
 

Public Attributes

vector< size_t > node_ids
 
unordered_map< size_t, size_t > sparse_to_dense
 
unordered_map< size_t, size_t > dense_to_sparse
 

Private Attributes

bool include_children
 

Constructor & Destructor Documentation

◆ SparseUnionFind()

vg::SparseUnionFind::SparseUnionFind ( bool  include_children,
vector< size_t >  node_ids 
)

◆ ~SparseUnionFind()

vg::SparseUnionFind::~SparseUnionFind ( )

Destructor.

Member Function Documentation

◆ all_groups()

vector< vector< size_t > > vg::SparseUnionFind::all_groups ( )

Returns all of the groups, each in a separate vector.

◆ find_group()

size_t vg::SparseUnionFind::find_group ( size_t  i)

Returns the group ID that index i belongs to (can change after calling union)

◆ group()

vector< size_t > vg::SparseUnionFind::group ( size_t  i)

Returns a vector of the indices in the same group as index i.

◆ group_size()

size_t vg::SparseUnionFind::group_size ( size_t  i)

Returns the size of the group containing index i.

◆ size()

size_t vg::SparseUnionFind::size ( )

Returns the number of indices in the UnionFind.

◆ union_groups()

void vg::SparseUnionFind::union_groups ( size_t  i,
size_t  j 
)

Merges the group containing index i with the group containing index j.

Member Data Documentation

◆ dense_to_sparse

unordered_map<size_t, size_t> vg::SparseUnionFind::dense_to_sparse

◆ include_children

bool vg::SparseUnionFind::include_children
private

◆ node_ids

vector<size_t> vg::SparseUnionFind::node_ids

◆ sparse_to_dense

unordered_map<size_t, size_t> vg::SparseUnionFind::sparse_to_dense

The documentation for this class was generated from the following files: