third_party/inchi/INCHI_BASE/src/ichicans.c
int find_atoms_with_parity( sp_ATOM *at,
                            S_CHAR  *visited,
                            int     from_atom,
                            int     cur_atom )
{
    int i, next_atom;

    if (visited[cur_atom])
    {
        return 0;
    }
    if (at[cur_atom].parity)
    {
        return 1;
    }

    visited[cur_atom] = 1;

    for (i = 0; i < at[cur_atom].valence; i++)
    {
        next_atom = at[cur_atom].neighbor[i];

        if (next_atom != from_atom &&
             find_atoms_with_parity( at, visited, cur_atom, next_atom ))
        {
            return 1;
        }
    }

    return 0;
}
/****************************************************************************
  Depth First Search for an atom with parity
****************************************************************************/
Depth First Search for an atom with parity
Depth First Search for an atom with parity
int find_atoms_with_parity( sp_ATOM *at,
                            S_CHAR  *visited,
                            int     from_atom,
                            int     cur_atom )
{
    int i, next_atom;
    if (visited[cur_atom])
    {
        return 0;
    }
    if (at[cur_atom].parity)
    {
        return 1;
    }
    visited[cur_atom] = 1;
    for (i = 0; i < at[cur_atom].valence; i++)
    {
        next_atom = at[cur_atom].neighbor[i];
        if (next_atom != from_atom &&
             find_atoms_with_parity( at, visited, cur_atom, next_atom ))
        {
            return 1;
        }
    }
    return 0;
}
int find_atoms_with_parity ( sp_ATOM * at , S_CHAR * visited , int from_atom , int cur_atom ) { int i , next_atom ; if ( visited [ cur_atom ] ) { return 0 ; } if ( at [ cur_atom ] . parity ) { return 1 ; } visited [ cur_atom ] = 1 ; for ( i = 0 ; i < at [ cur_atom ] . valence ; i ++ ) { next_atom = at [ cur_atom ] . neighbor [ i ] ; if ( next_atom != from_atom && find_atoms_with_parity ( at , visited , cur_atom , next_atom ) ) { return 1 ; } } return 0 ; }
Depth First Search for an atom with parity
Depth First Search for an atom with parity