27                       const std::vector<std::vector<int32> > &graph2) {
    28   if (graph1.size() != graph2.size()) { 
return false; }
    29   for (
int32 i = 0; 
i < graph1.size(); ++
i) {
    30     if (graph1[
i].size() != graph2[
i].size()) { 
return false; }
    31     for (
int32 j = 0; 
j < graph1[
i].size(); ++
j) {
    32       if (graph1[
i][
j] != graph2[
i][
j]) { 
return false; }
    39                        const std::vector<int32> &vec2) {
    40   if (vec1.size() != vec2.size()) { 
return false; }
    41   for (
int32 i = 0; 
i < vec1.size(); ++
i) {
    42     if (vec1[
i] != vec2[
i]) { 
return false; }
    61   std::vector<int32> tmp;
    62   tmp.resize(1); tmp[0] = 4; (*graph)[0] = tmp;
    63   tmp.resize(1); tmp[0] = 0; (*graph)[1] = tmp;
    64   tmp.resize(2); tmp[0] = 1; tmp[1] = 3; (*graph)[2] = tmp;
    65   tmp.resize(1); tmp[0] = 2; (*graph)[3] = tmp;
    66   tmp.resize(1); tmp[0] = 1; (*graph)[4] = tmp;
    67   tmp.resize(3); tmp[0] = 1; tmp[1] = 4; tmp[2] = 6; (*graph)[5] = tmp;
    68   tmp.resize(1); tmp[0] = 5; (*graph)[6] = tmp;
    69   tmp.resize(3); tmp[0] = 7; tmp[1] = 3; tmp[2] = 6; (*graph)[7] = tmp;
    86   std::vector<int32> tmp;
    87   tmp.resize(1); tmp[0] = 1; (*graph)[0] = tmp;
    88   tmp.resize(3); tmp[0] = 2; tmp[1] = 4; tmp[2] = 5; (*graph)[1] = tmp;
    89   tmp.resize(1); tmp[0] = 3; (*graph)[2] = tmp;
    90   tmp.resize(2); tmp[0] = 2; tmp[1] = 7; (*graph)[3] = tmp;
    91   tmp.resize(2); tmp[0] = 0; tmp[1] = 5; (*graph)[4] = tmp;
    92   tmp.resize(1); tmp[0] = 6; (*graph)[5] = tmp;
    93   tmp.resize(2); tmp[0] = 5; tmp[1] = 7; (*graph)[6] = tmp;
    94   tmp.resize(1); tmp[0] = 7; (*graph)[7] = tmp;
   107   std::vector<int32> tmp;
   108   tmp.resize(3); tmp[0] = 1; tmp[1] = 4; tmp[2] = 0; (*sccs)[0] = tmp;
   109   tmp.resize(2); tmp[0] = 3; tmp[1] = 2; (*sccs)[1] = tmp;
   110   tmp.resize(2); tmp[0] = 6; tmp[1] = 5; (*sccs)[2] = tmp;
   111   tmp.resize(1); tmp[0] = 7; (*sccs)[3] = tmp;
   117   scc_graph->resize(4);
   124   std::vector<int32> tmp;
   125   tmp.resize(0); (*scc_graph)[0] = tmp;
   126   tmp.resize(1); tmp[0] = 0; (*scc_graph)[1] = tmp;
   127   tmp.resize(1); tmp[0] = 0; (*scc_graph)[2] = tmp;
   128   tmp.resize(2); tmp[0] = 1; tmp[1] = 2; (*scc_graph)[3] = tmp;
   133   node_to_order->clear();
   134   node_to_order->resize(4);
   142   (*node_to_order)[0] = 3;
   143   (*node_to_order)[1] = 2;
   144   (*node_to_order)[2] = 1;
   145   (*node_to_order)[3] = 0;
   149   std::vector<std::vector<int32> > graph;
   152   std::vector<std::vector<int32> > graph_transpose;
   155   std::vector<std::vector<int32> > ref_graph_transpose;
   161   std::vector<std::vector<int32> > graph;
   164   std::vector<std::vector<int32> > sccs;
   167   std::vector<std::vector<int32> > ref_sccs;
   173   std::vector<std::vector<int32> > graph;
   176   std::vector<std::vector<int32> > sccs;
   179   std::vector<std::vector<int32> > scc_graph;
   182   std::vector<std::vector<int32> > ref_scc_graph;
   188   std::vector<std::vector<int32> > scc_graph;
   191   std::vector<int32> node_to_order;
   194   std::vector<int32> ref_node_to_order;
   203   std::vector<std::vector<int32> > graph;
   209   graph[0].push_back(1); graph[0].push_back(3);
   210   graph[1].push_back(2);
   211   graph[2].push_back(4);
   212   graph[3].push_back(2);
   216   std::vector<int32> ref_node_to_order;
   217   ref_node_to_order.push_back(0); 
   218   ref_node_to_order.push_back(2); 
   219   ref_node_to_order.push_back(3); 
   220   ref_node_to_order.push_back(1); 
   221   ref_node_to_order.push_back(4); 
   223   std::vector<int32> computed_node_to_order;
   232   using namespace kaldi;
   241   KALDI_LOG << 
"Nnet graph tests succeeded.";
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void UnitTestComputeTopSortOrder2()
 
bool AssertVectorEqual(const std::vector< int32 > &vec1, const std::vector< int32 > &vec2)
 
void BuildTestGraph(std::vector< std::vector< int32 > > *graph)
 
void ComputeGraphTranspose(const std::vector< std::vector< int32 > > &graph, std::vector< std::vector< int32 > > *graph_transpose)
Outputs a graph in which the order of arcs is reversed. 
 
void ComputeTopSortOrder(const std::vector< std::vector< int32 > > &graph, std::vector< int32 > *node_to_order)
Given an acyclic graph (where each std::vector<int32> is a list of destination-nodes of arcs coming f...
 
void UnitTestComputeTopSortOrder()
 
void BuildTestSccGraph(std::vector< std::vector< int32 > > *scc_graph)
 
void UnitTestComputeGraphTranspose()
 
void FindSccs(const std::vector< std::vector< int32 > > &graph, std::vector< std::vector< int32 > > *sccs)
Given a directed graph (where each std::vector<int32> is a list of destination-nodes of arcs coming f...
 
void UnitTestMakeSccGraph()
 
void BuildTestSccs(std::vector< std::vector< int32 > > *sccs)
 
This file contains a few functions that treat the neural net as a graph on nodes: e...
 
#define KALDI_ASSERT(cond)
 
void MakeSccGraph(const std::vector< std::vector< int32 > > &graph, const std::vector< std::vector< int32 > > &sccs, std::vector< std::vector< int32 > > *scc_graph)
Given a list of sccs of a graph (e.g. 
 
void BuildTestTopSortOrder(std::vector< int32 > *node_to_order)
 
void BuildTestGraphTranspose(std::vector< std::vector< int32 > > *graph)
 
bool AssertGraphEqual(const std::vector< std::vector< int32 > > &graph1, const std::vector< std::vector< int32 > > &graph2)