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

Public Member Functions

 NodeDirectory (const SnarlManager &manager, const HandleGraph &graph)
 
std::optional< ChainPosition > chain_position (nid_t id) const
 
const Snarl * containing_snarl (nid_t id) const
 
const std::vector< nid_t > & free_nodes (const Snarl *snarl) const
 

Private Attributes

const SnarlManager & manager
 The manager whose snarl tree the nodes sit in. More...
 
std::unordered_map< nid_t, const Snarl * > free_node_snarls
 
std::unordered_map< const Snarl *, std::vector< nid_t > > free_nodes_by_snarl
 

Detailed Description

A directory of where each node of a graph sits in the snarl tree.

The directory finds chain nodes through the manager's index of the snarls each node side leads into, and lists the free nodes itself.

Constructor & Destructor Documentation

◆ NodeDirectory()

vg::SnarlManagerDecomposition::NodeDirectory::NodeDirectory ( const SnarlManager &  manager,
const HandleGraph &  graph 
)

Find the free nodes of a graph in a manager's snarl tree.

The directory keeps a reference to the manager, so it must outlive the directory.

Precondition
finish() has been called on the manager.

Member Function Documentation

◆ chain_position()

optional< SnarlManagerDecomposition::ChainPosition > vg::SnarlManagerDecomposition::NodeDirectory::chain_position ( nid_t  id) const

Get the place of a node in its chain, or nullopt for a free node, in constant time.

◆ containing_snarl()

const Snarl * vg::SnarlManagerDecomposition::NodeDirectory::containing_snarl ( nid_t  id) const

Get the snarl that directly contains a node, or null for the root.

Precondition
The node is in the graph.

◆ free_nodes()

const vector< nid_t > & vg::SnarlManagerDecomposition::NodeDirectory::free_nodes ( const Snarl *  snarl) const

Get the free nodes in a snarl, or in the root if given null, in ID order.

Member Data Documentation

◆ free_node_snarls

std::unordered_map<nid_t, const Snarl*> vg::SnarlManagerDecomposition::NodeDirectory::free_node_snarls
private

The snarl that directly contains each free node, or null for the root.

◆ free_nodes_by_snarl

std::unordered_map<const Snarl*, std::vector<nid_t> > vg::SnarlManagerDecomposition::NodeDirectory::free_nodes_by_snarl
private

The free nodes in each snarl that has any, and in the root under null. Each list is in ID order.

◆ manager

const SnarlManager& vg::SnarlManagerDecomposition::NodeDirectory::manager
private

The manager whose snarl tree the nodes sit in.


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