void graph1() { int sher; clrscr(); textcolor(WHITE); gotoxy(24,3); printf("\xDB\xDB\xDB\xDB\xB2 BAR GRAPH \xB2\xDB\xDB\xDB\xDB"); gotoxy(10,5); printf("THIS SECTION IS TO show the graph of quantity and profit "); printf("\n\n\t ********* ENTER THE OPTION WHICH SUITS YOU. *******\n"); printf("\n\n\t\xDB\xDB\xB2 1.QUANTITY.\n\n"); printf("\n\t\xDB\xDB\xB2 2.PROFIT.\n"); printf("\n\n\n\t\t\xDB\xDB\xB2 OPTION:"); sher=toupper(getch()); switch(sher) { case '1': graph(); break; case '2': graph2(); break; default: gotoxy(9,20); textcolor(RED); cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO TO MAIN MENU... "); getche(); } }
TEST(GraphTest, size) { MolCore::Graph graph; EXPECT_EQ(graph.size(), 0); MolCore::Graph graph2(12); EXPECT_EQ(graph2.size(), 12); }
TEST(DBGBloom, BloomFilterPolymorphism) { unsigned bits = 100000; Kmer::setLength(3); Kmer kmer1("GAC"); Kmer kmer2("ACC"); Kmer kmer3("CCA"); CascadingBloomFilter countingBloom(bits); countingBloom.insert(kmer1); countingBloom.insert(kmer1); countingBloom.insert(kmer2); countingBloom.insert(kmer2); countingBloom.insert(kmer3); countingBloom.insert(kmer3); DBGBloom<CascadingBloomFilter> graph(countingBloom); // test that expected edges exist boost::graph_traits< DBGBloom<CascadingBloomFilter> >::out_edge_iterator ei, ei_end; boost::tie(ei, ei_end) = out_edges(kmer1, graph); ASSERT_TRUE(ei != ei_end); EXPECT_TRUE(target(*ei, graph) == kmer2); ei++; EXPECT_TRUE(ei == ei_end); boost::tie(ei, ei_end) = out_edges(kmer2, graph); ASSERT_TRUE(ei != ei_end); EXPECT_TRUE(target(*ei, graph) == kmer3); ei++; EXPECT_TRUE(ei == ei_end); boost::graph_traits< DBGBloom<BloomFilter> >::out_edge_iterator ei2, ei_end2; DBGBloom<BloomFilter> graph2(countingBloom.getBloomFilter(1)); // test that the same edges exist in non-counting // bloom filter boost::tie(ei2, ei_end2) = out_edges(kmer1, graph2); ASSERT_TRUE(ei2 != ei_end2); EXPECT_TRUE(target(*ei2, graph2) == kmer2); ei2++; EXPECT_TRUE(ei2 == ei_end2); boost::tie(ei2, ei_end2) = out_edges(kmer2, graph2); ASSERT_TRUE(ei2 != ei_end2); EXPECT_TRUE(target(*ei2, graph2) == kmer3); ei2++; EXPECT_TRUE(ei2 == ei_end2); }
void histo_graph(TH1D *histo,TGraph *graph,Int_t N_to_fill) { Int_t N_Points=graph->GetN(); Double_t x,y; Double_t y_min=0.0; Double_t y_max=0.0; Double_t x_min=0.0; Double_t x_max=0.0; for (Int_t i=0;i<N_Points;i++) { graph->GetPoint(i,x,y); if (y>y_max) y_max=y; if (x>x_max) x_max=x; if (y<y_min) y_min=y; if (x<x_min) x_min=x; } Double_t histo_x_min=histo->GetXaxis()->GetXmin(); Double_t histo_x_max=histo->GetXaxis()->GetXmax(); if (histo_x_min>x_min) x_min=histo_x_min; if (histo_x_max<x_max) x_max=histo_x_max; //reverse graph order if necessary TGraph graph2(N_Points); Double_t x0,xNm1; graph->GetPoint(0,x0,y); graph->GetPoint(N_Points-1,xNm1,y); if (xNm1<x0) { for (Int_t iPoint=0;iPoint<N_Points;iPoint++) { Double_t x,y; graph->GetPoint(N_Points-iPoint,x,y); graph2.SetPoint(iPoint,x,y); } graph=&graph2; } TRandom3 r; r.SetSeed(0); Int_t N_tried=0; Int_t N_filled=0; while (N_filled<N_to_fill) { N_tried++; //rejection method x=r.Uniform(x_min,x_max); y=r.Uniform(0.0,y_max); if (y<graph->Eval(x)) { histo->Fill(x); N_filled++; } } printf("x_max=%8.6g; x_min=%8.6g; y_max=%8.6g; N_filled=%d; N_tried=%d\n",x_max,x_min,y_max,N_filled,N_tried); Double_t norm=(x_max-x_min)*y_max*N_filled/N_tried; histo->Scale(norm/histo->Integral("width")); }
void read_edge_by_line(FILE *f, graph2 &g, graph2 &g_reversed) { int i_number_vertices, i_number_of_edges, j; char pch_line[128], *pch; // = new char[16]; fscanf(f, "%d %d\n", &i_number_vertices, &i_number_of_edges); vector<int> data(2 * i_number_of_edges); for (int i = 0; i < 2 * i_number_of_edges; i += 2) { fgets(pch_line, 128, f); pch = strtok(pch_line, " "); j = atol(pch); data[i] = j; pch = strtok(NULL, " \n"); j = atol(pch); data[i + 1] = j; } int size_vector = *max_element(data.begin(), data.end()); g = graph2(size_vector + 1); g_reversed = graph2(size_vector + 1); for (int i = 0; i < 2 * i_number_of_edges; i += 2) { if (g[data[i]] == NULL) g[data[i]] = new vector<int>(); if (g[data[i + 1]] == NULL) g[data[i + 1]] = new vector<int>(); g[data[i]]->push_back(data[i + 1]); if (g_reversed[data[i + 1]] == NULL) g_reversed[data[i + 1]] = new vector<int>(); if (g_reversed[data[i]] == NULL) g_reversed[data[i]] = new vector<int>(); g_reversed[data[i + 1]]->push_back(data[i]); } }
int main(int argc, char **argv) { t_mlx *ptr; t_img *i; ptr = init_mlx(); i = init_img(ptr); if (argc == 2) bombyx1(i, ptr, argv[1]); if (argc == 3) graph2(argv, ptr, i); else printf("Usage: ./106bombyx [-k] OR [-i_min -i_max]"); printf("\n"); return (0); }
void graphepf(std::stringstream & stream) { Graph<int> graph4(4); Graph<int> graph5(5); Graph<int> graph6(6); Graph<int> graph3(3); Graph<int> graph2(2); Graph<int> graph1(1); graph4.add(&graph6); graph4.add(&graph3); graph3.add(&graph2); graph6.add(&graph5); graph6.add(&graph5); graph2.add(&graph6); graph2.add(&graph1); graph5.add(&graph1); graph4.display(stream); }