コード例 #1
0
ファイル: computed_value.cpp プロジェクト: kdt3rd/gecko
void
computed_base::internal_copy( const computed_base &o )
{
	clear_graph();
	_graph = o._graph;
	set_id( o._id );
}
コード例 #2
0
ファイル: computed_value.cpp プロジェクト: kdt3rd/gecko
void
computed_base::adopt( computed_base &&o )
{
	// need to update the ref count and leave the old one since we're
	// passing this off to the graph
	clear_graph();
	_graph = o._graph;
	set_id( o._id );
}
コード例 #3
0
ファイル: Graph.cpp プロジェクト: OanceaLucian/Lab-pa-2014
void Graph::init_from_file( const std::string& input_graph )
{
	clear_graph();

	std::fstream in(input_graph.c_str(), std::fstream::in );
	if( !in.good() ){
		throw InvalidQuery("Check input file path!");
	}

	in >> *this;
	in.close();
}
コード例 #4
0
ファイル: 821.cpp プロジェクト: eltonvs/code_training
int main() {
    int a, b, c = 1, cc = 0;

    clear_graph();

    while (std::cin >> a >> b) {
        if (!(a | b)) {
            if (cc == 0) {
                break;
            }
            floyd_warshall();
            double ans = avg_calc();
            cc = 0;
            printf("Case %i: average length between pages = %.3f clicks\n", c++, ans);
            // Clear Graphs
            clear_graph();
        } else {
            cc++;
            graph[a].push_back(b);
        }
    }

    return 0;
}
コード例 #5
0
ファイル: proj2.c プロジェクト: ruimams/ASA-project2
void read_problems_write_answers() {
	int n_probs, i, n_cp, main_cp, j, prob_min_cut, a_cp;

    if (scanf("%d", &n_probs) != 1) exit(EXIT_FAILURE);

    for (i = 0; i < n_probs; i++) {
    	if (scanf("%d %d", &n_cp, &main_cp) != 2) exit(EXIT_FAILURE);

    	for (j = 1, prob_min_cut = INT_MAX; j < n_cp; j++) {
            if (scanf("%d", &a_cp) != 1) exit(EXIT_FAILURE);

    		prob_min_cut = min(prob_min_cut, min_cut(main_cp, a_cp));
    		clear_graph();
    	}

    	printf("%d\n", prob_min_cut);
    }
}
コード例 #6
0
ファイル: computed_value.cpp プロジェクト: kdt3rd/gecko
computed_base::~computed_base( void )
{
	clear_graph();
}