Grafalgo
Library of useful data structures and algorithms
grafalgo::Nca Class Reference

Class that computes nearest common ancestors in a tree. More...

#include <Nca.h>

Collaboration diagram for grafalgo::Nca:

List of all members.

Classes

struct  VertexPair

Public Member Functions

 Nca (Graph &, vertex, VertexPair[], int, vertex[])
 Compute nearest common ancestors of specified pairs of vertices.

Private Types

enum  state_t { unreached, open, closed }

Private Member Functions

void compute_nca (vertex, vertex)
 Recursive computation of nca values.

Private Attributes

Graphtp
vertex root
VertexPairpairs
int np
vertex * ncav
Graphgp
Partitionpp
vertex * noa
state_t * state

Detailed Description

Class that computes nearest common ancestors in a tree.

The computation is invoked using the constructor.

Definition at line 23 of file Nca.h.


Constructor & Destructor Documentation

grafalgo::Nca::Nca ( Graph t,
vertex  root1,
VertexPair  pairs1[],
int  np1,
vertex  ncav1[] 
)

Compute nearest common ancestors of specified pairs of vertices.

Parameters:
tis a reference to a graph object that is a tree
root1is the root of the tree
pairs1is an array of VertexPair structures that identify the pairs of vertices for which we compute ncas
np1is the number of pairs in pairs1
ncav1is an array in which the nca values are returned

Definition at line 21 of file Nca.cpp.

Here is the call graph for this function:


Member Function Documentation

void grafalgo::Nca::compute_nca ( vertex  u,
vertex  pu 
) [private]

Recursive computation of nca values.

Parameters:
uis the current vertex in the recursive computation
puis the parent of u; in the top-level call pu==0

Definition at line 43 of file Nca.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends