Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
generate_df_tree.H File Reference

Pictures of depth-first trees with their df and low numbers. More...

#include <algorithm>
#include <memory>
#include <ostream>
#include <sstream>
#include <string>
#include <utility>
#include <ah-errors.H>
#include <ah-graph-concepts.H>
#include <generate_tree.H>
#include <htlist.H>
#include <tpl_dfs_stack.H>
#include <tpl_dynMapTree.H>
#include <tpl_graph.H>
#include <tpl_tree_node.H>
Include dependency graph for generate_df_tree.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Df_Low_Key
 Key of a node of a depth-first tree with df and low numbers. More...
 
struct  Aleph::Dft_Df_Tree_Label< GT >
 Default label of a graph node: its information, written with operator <<. More...
 
struct  Aleph::Write_Df_Tree_Label
 Writer for generate_tree() that shows the label of each node. More...
 
struct  Aleph::Write_Df_Tree_Df
 Writer for generate_tree() that shows the label and the df number of each node, as (label,df). More...
 
struct  Aleph::Write_Df_Tree_Low
 Writer for generate_tree() that shows the label, the df and the low numbers of each node, as label,df,low. More...
 
class  Aleph::df_tree_detail::Df_Low_Builder< GT, Node_Label, SA >
 Depth-first traversal that builds the tree of build_df_low_tree(). More...
 
struct  Aleph::df_tree_detail::Df_Low_Builder< GT, Node_Label, SA >::Frame
 
struct  Aleph::df_tree_detail::Dewey_Level
 A level of the path that number_tree() follows: the length of the Dewey number of the parent, and the position of the node among its siblings. More...
 
struct  Aleph::df_tree_detail::Tree_Deleter
 Deleter that frees a whole tree. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::df_tree_detail
 

Typedefs

using Aleph::Df_Low_Tree_Node = Tree_Node< Df_Low_Key >
 Node of the depth-first tree that build_df_low_tree() returns.
 
using Aleph::Df_Low_Non_Tree_Arc = std::pair< Df_Low_Tree_Node *, Df_Low_Tree_Node * >
 Arc of the graph that is not in the depth-first tree.
 

Functions

void Aleph::df_tree_detail::number_tree (Df_Low_Tree_Node *root, const DynList< Df_Low_Non_Tree_Arc > &arcs, DynMapTree< Df_Low_Tree_Node *, std::string > &numbers)
 Give to each node that an arc of arcs names its Dewey number, as generate_tree() writes them.
 
template<AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Df_Low_Tree_Node * Aleph::build_df_low_tree (const GT &g, typename GT::Node *src, DynList< Df_Low_Non_Tree_Arc > &non_tree_arcs, Node_Label node_label=Node_Label(), SA sa=SA())
 Build the depth-first spanning tree of an undirected graph, with the df and low numbers of its nodes.
 
template<class Write = Write_Df_Tree_Low, AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::write_df_low_tree (const GT &g, typename GT::Node *src, std::ostream &out, Node_Label node_label=Node_Label(), SA sa=SA())
 Write, for ntreepic, the depth-first spanning tree of an undirected graph with the df and low numbers of its nodes.
 

Detailed Description

Pictures of depth-first trees with their df and low numbers.

write_df_low_tree() writes, for the tree drawing program ntreepic, the depth-first spanning tree of an undirected graph from a start node. Each node of the tree shows the label of its graph node, its depth-first number (df) and its low number, the numbers with which Compute_Cut_Nodes finds the cut nodes (see tpl_cut_nodes.H). Each arc of the graph that is not in the tree is drawn as a dashed connection between its two nodes.

The numbers are those of Compute_Cut_Nodes: the start node has df 0, each other node gets the next number when the traversal discovers it, and the low number of a node is the smallest df that the node reaches through its subtree and at most one arc that is not in the tree. The start node has no low number (-1), as its cut-node test does not use it.

build_df_low_tree() returns the same tree as a Tree_Node, together with the arcs that are not in it, for other uses or other pictures.

Example

using Graph = List_Graph<Graph_Node<int>, Graph_Arc<int>>;
// ... insert the nodes and arcs ...
std::ofstream out("df-low.Tree");
write_df_low_tree(g, src, out); // labels "key,df,low"
write_df_low_tree<Write_Df_Tree_Df>(g, src, out); // labels "(key,df)"
size_t size_t int32_t * out
Definition ca-c-api.h:120
void write_df_low_tree(const GT &g, typename GT::Node *src, std::ostream &out, Node_Label node_label=Node_Label(), SA sa=SA())
Write, for ntreepic, the depth-first spanning tree of an undirected graph with the df and low numbers...

These functions do not modify the graph: they use neither the cookies nor the counters nor the control bits of its nodes and arcs.

See also
tpl_cut_nodes.H For cut nodes, bridges and biconnected components
generate_tree.H For the format that ntreepic reads
Author
Leandro Rabindranath Leon

Definition in file generate_df_tree.H.