示例#1
0
void PlotData(const char *title, const char *xaxis, const char *yaxis,
	double xmin, double xmax, std::vector<double> &values)
{
	CImg<double> y(values.data(), values.size());

	const unsigned int plot_type = 1;
	const unsigned int vertex_type = 0;

	if (y.is_empty()) return;

	CImgDisplay disp;
	disp.assign(cimg_fitscreen(640,480,1),0,0).set_title(title);
	show_graph(disp, y, plot_type, vertex_type, xaxis, xmin, xmax, yaxis);
}
示例#2
0
int main(){
    int G[MAX][MAX]={0},V;
    printf("Enter the number of nodes of the graph: ");
    scanf("%d",&V);
    //read_graph(G,V);
    addEdge(G,V,0,1);
    addEdge(G,V,0,3);
    addEdge(G,V,1,0);
    addEdge(G,V,2,0);
    addEdge(G,V,2,1);
    addEdge(G,V,3,0);
    addEdge(G,V,3,2);
    show_graph(G,V);
	dfs(G,V,2);
	return 0;
}
示例#3
0
void Scope2(const char *title, std::vector<double> &values)
{
	CImg<double> y(values.data(), values.size());

	float x0 =    0.0f;
	float x1 =  1.25f * values.size();
	const unsigned int plot_type = 1;
	const unsigned int vertex_type = 0;

	if (y.is_empty()) return;

	CImgDisplay disp;
	disp.assign(cimg_fitscreen(640,480,1),0,0).set_title(title);
	show_graph(disp, y, plot_type, vertex_type, "t / ns", x0, x1, "adc units");

//	y.display_graph(title ,plot_type, vertex_type, "t / ns", x0,x1, "adc units");
}
示例#4
0
文件: parse.c 项目: JackWyj/Tiger
static void doProc(FILE *out, F_frame frame, T_stm body)
{
	//printStm(body);
	AS_proc proc;
	T_stmList stmList;
	AS_instrList iList;
	stmList = C_linearize(body);
	stmList = C_traceSchedule(C_basicBlocks(stmList));
	//printStmList(stdout, stmList);
	iList  = codegen(frame, stmList); /* 9 */
	G_graph g = FG_AssemFlowGraph(iList);
	//G_show(stdout, G_nodes(g), show_instr);
	//show_graph(g);
	struct L_graph lg = L_liveness(g);
	show_graph(lg.graph);
	fprintf(out, "BEGIN %s\n", Temp_labelstring(F_name(frame)));
	AS_printInstrList (out, iList, Temp_layerMap(F_tempMap,Temp_name()));
	fprintf(out, "END %s\n\n", Temp_labelstring(F_name(frame)));
}
示例#5
0
文件: graph.c 项目: matz/streem
static int
iter_bar(strm_stream* strm, strm_value data)
{
  struct bar_data* d = strm->data;
  double f, max = 1.0;

  if (interrupt) {
    interrupt = FALSE;
    strm_unsignal(SIGINT, sigupdate);
    move_cursor(d->row-1, 1);
    show_cursor();
    exit(1);
  }
  if (!strm_number_p(data)) {
    strm_raise(strm, "invalid data");
    return STRM_NG;
  }

  if (winch) {
    winch = FALSE;
    free(d->data);
    if (init_bar(d) == STRM_NG) {
      strm_stream_close(strm);
      return STRM_NG;
    }
  }
  f = strm_value_float(data);
  if (f < 0) f = 0;
  d->data[d->offset++] = f;
  max = 1.0;
  for (int i=0; i<d->dlen; i++) {
    f = d->data[i];
    if (f > max) max = f;
  }
  d->max = max;
  if (d->offset == d->dlen) {
    d->offset = 0;
  }
  show_graph(d);
  return STRM_OK;
}
示例#6
0
/*
 * on_tree_view_row_selected
 * Evento "doppio-click" su una riga del treeview
 * 
 */
void on_tree_view_row_selected (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) 
{   
	GtkTreeIter iter;
	GtkTreeModel *model;
	gint id;
	VESLog *veslog = (VESLog *) user_data;
	
	/* Recupero le informazioni sulla riga selezionata */
	model = gtk_tree_view_get_model(tree_view);
	if (gtk_tree_model_get_iter(model, &iter, path)) {
		gtk_tree_model_get(model, &iter, COL_ID, &id, -1);
	}
	
	printf("puppa\n");
	
	/* 
	 * Richiamo la funzione show_graph() per visualizzare la finestra di dialogo
	 * con i grafici e i dati realativi alla riga selezionata
	 */
	show_graph(veslog->Data[(int)id]);
}
示例#7
0
static void decode(struct holder *holder)
{
	unsigned int channels = holder->ininfo.channels;
	float buf[channels * holder->samples_count];
	int count, short_read;

	do {
		count = sf_readf_float(holder->infile, buf,
				holder->samples_count);
		if (count <= 0)
			break;

		/* the last chunk? */
		short_read = count != holder->samples_count;
		if (!short_read) {
			compute_avg(holder, buf, count);
			compute_fftw(holder);
			show_graph(holder);
		}

		write_snd(holder, buf, count);
	} while (!short_read);
}
int main()
{
	graph_link gl;

	init_graph(&gl);

	insert_vertex(&gl, 'A');
	insert_vertex(&gl, 'B');
	insert_vertex(&gl, 'C');
	insert_vertex(&gl, 'D');
	insert_vertex(&gl, 'E');
	insert_vertex(&gl, 'F');
	insert_vertex(&gl, 'G');
	insert_vertex(&gl, 'H');
	insert_vertex(&gl, 'I');
	insert_vertex(&gl, 'J');
	insert_vertex(&gl, 'K');
	insert_vertex(&gl, 'L');
	insert_vertex(&gl, 'M');

	insert_edge(&gl, 'A', 'B');
	insert_edge(&gl, 'A', 'C');
	insert_edge(&gl, 'A', 'F');
	insert_edge(&gl, 'A', 'L');
	insert_edge(&gl, 'B', 'M');
	insert_edge(&gl, 'L', 'J');
	insert_edge(&gl, 'L', 'M');
	insert_edge(&gl, 'J', 'M');

	insert_edge(&gl, 'D', 'E');

	insert_edge(&gl, 'G', 'H');
	insert_edge(&gl, 'G', 'I');
	insert_edge(&gl, 'G', 'K');
	insert_edge(&gl, 'H', 'K');

	printf("\n");
	show_graph(&gl);

	printf("Depth First Search(DFS) all nodes of the graph: \n");
	depth_first_search(&gl, 'D');
	printf("Nul\n");

	printf("Breadth First Search(BFS) all nodes of the graph: \n");
	breadth_first_search(&gl, 'A');
	printf("Nul\n");

	printf("Non connect graph DFS: \n");
	components(&gl);
	printf("Nul\n");

	//int v = get_first_neighbor(&gl, 'A');
	//printf("The first neighbor node of 'A' is: %d\n", v);

	//int v1 = get_next_neighbor(&gl, 'B', 'E');
	//printf("The next neighbor node of 'B' and 'E' is: %d\n", v1);
	//printf("\n");

	//delete_edge(&gl, 'B', 'C');
	//show_graph(&gl);

	//delete_vertex(&gl, 'C');
	destroy_graph(&gl);
}