コード例 #1
0
ファイル: map_bfs.cpp プロジェクト: boostpro/labs
// Read a graph from input in adjacency list form.
void read_adjacency_list( std::istream& input, graph& g )
{
    for ( std::string line; std::getline(input, line); )
    {
        vertex_id src = add_vertex( g );
        
        std::stringstream s(line);
        for ( int dst; s >> dst; )
        {
            // Make up an arbitrary weight
            edge_weight w = (1 + count_adj(g, src)) * 1.0 / count_vertices(g);
            add_edge( g, src, dst, w );
        }
    }
コード例 #2
0
ファイル: error.c プロジェクト: rorousse/fillit
int		check_adj(t_tetris tetri_list)
{
	int		i;
	int		count;

	i = 0;
	count = 0;
	while (tetri_list.figure[i])
	{
		if (tetri_list.figure[i] == '#')
			count = count + count_adj(tetri_list, i);
		i++;
	}
	if (count >= 6)
		return (0);
	return (-1);
}