void GraphTimer::draw() { ImGui::Begin("Performance"); std::string title = std::to_string(fps_vectors.at(0).at(counters.at(0))); std::vector<ImColor> colors = { ImColor(255, 255, 255), ImColor(255, 255, 0), ImColor( 0, 255, 255), ImColor(255, 0, 255), ImColor(255, 0, 0), ImColor( 0, 255, 0), ImColor( 0, 0, 255), }; ImVec2 wh = ImGui::GetContentRegionAvail(); wh.x -= wh.x * 0.15; sf::Vector2f graph_size(wh.x, wh.y); ImGui::PlotMultiLines(fps_vectors, title, labels, colors, 200, 0, graph_size); ImGui::End(); }
/***** * Read Users from a File * * Reads UIDs * Assigns interests at random * Creates similarity matricies */ int from_file(int*** uu, int*** ii, int*** interests, int** uid){ int m, i, j; char* file_name = (char*)malloc(sizeof(char)*MAX_WORD); printf("File name: "); scanf("%s", file_name); FILE* fp; int **int_temp, *uid_temp; m = graph_size(fp, file_name); // Get UIDs int* temp_ids = (int*)calloc(m, sizeof(int)); temp_ids = get_uid(fp, file_name, m); *uid = temp_ids; // Make User X Interest Matrix assign_interests(m, &int_temp, END); *interests = int_temp; // Similarities similarity(m, int_temp, uu, ii); return m; }
status traverse_graph( graph G, searchorder order, status ( *p_func_f )()) { status rc ; bool *visited; int vertex_cnt, edge_cnt, i; graph_size( G, &vertex_cnt, &edge_cnt ) ; visited = ( bool* )malloc( vertex_cnt * sizeof( bool )) ; if( visited == NULL ) return ERROR ; for( i = 0 ; i < vertex_cnt ; i++ ) visited[i] = FALSE ; for( rc = OK, i = 0 ; i < vertex_cnt && rc == OK ; i++ ) { if( visited[i] == FALSE ) { switch( order ) { case DEPTH_FIRST: rc = depth_first_search( G, i, visited, p_func_f ) ; break ; case BREADTH_FIRST: break ; case TOPOLOGICAL: rc = topological_sort( G, vertex_cnt, p_func_f ) ; i = vertex_cnt ; break ; } } } free( visited ) ; return rc ; }