static bool isExclusive(const NGHolder &h, const u32 num, unordered_set<u32> &tailId, map<u32, unordered_set<u32>> &skipList, const RoleInfo<role_id> &role1, const RoleInfo<role_id> &role2) { const u32 id1 = role1.id; const u32 id2 = role2.id; if (contains(skipList, id1) && contains(skipList[id1], id2)) { return false; } const auto &triggers1 = role1.literals; const auto &triggers2 = role2.literals; if (isSuffix(triggers1, triggers2)) { skipList[id2].insert(id1); return false; } DEBUG_PRINTF("role id2:%u\n", id2); const auto &cr1 = role1.cr; if (overlaps(cr1, role2.last_cr)) { CharReach cr = cr1 | role1.prefix_cr; flat_set<NFAVertex> states; for (const auto &lit : triggers2) { auto lit1 = findStartPos(cr, lit); if (lit1.empty()) { continue; } states.clear(); if (lit1.size() < lit.size()) { // Only starts. states.insert(h.start); states.insert(h.startDs); } else { // All vertices. insert(&states, vertices(h)); } auto activeStates = execute_graph(h, lit1, states); // Check if only literal states are on for (const auto &s : activeStates) { if ((!is_any_start(s, h) && h[s].index <= num) || contains(tailId, h[s].index)) { skipList[id2].insert(id1); return false; } } } } return true; }
int main() { int rows; int cols; int c; //scanf("%d %d\n", &rows, &cols); scanf("%d", &rows); scanf("%d", &cols); while ((c = getchar()) != '\n'); if(rows < 0 || cols < 0) //error check for senseless lengths of rows or columns { fprintf(stderr,"Error: Invalid number of columns or rows."); exit(2); } else { rows = rows + 2; //rows and cols incremented to add border around cols = cols + 2; int **table = makeTable(rows, cols); int tableFilled = fillTable(table, rows, cols); if(tableFilled == 0) { int **workTable = makeWorkTable(table, rows, cols); int temp = 1; if(findStartPos(table, workTable, rows, cols)) { fillTableWithPaths(workTable, rows, cols); temp = findEndPos(table, workTable, rows, cols); } if(temp == 0 || temp == 1) { int i, j; for(i = 1; i < rows - 1; i++) //print the maze with the path and without the border { for(j = 1; j < cols - 1; j++) { printf("%c", table[i][j]); } printf("%s", "\n"); } } freeSpace(table, workTable, rows); } else { fprintf(stderr,"Error: Invalid input with the specified rows and columns."); exit(2); } } return 0; }
void doPrintGenes(char *chromName, struct dnaSeq *seq) { struct genePred *genes = NULL; struct genePred *gene = NULL; struct snp *snps = NULL; struct snp *snp = NULL; int startPos = 0; int endPos = 0; int exonPos = 0; genes = readGenes(chromName); for (gene = genes; gene != NULL; gene = gene->next) { // printf("gene = %s %s:%d-%d\n", gene->name, chromName, gene->txStart, gene->txEnd); snps = readSnpsFromGene(gene, chromName); for (snp = snps; snp != NULL; snp = snp->next) { // for each SNP, figure out flanking start and stop // first figure out which exon contains the snp exonPos = findExonPos(gene, snp->chromStart); // exonPos will return -1 if the position isn't in any exon if (exonPos == -1) continue; // exonPos should also never be 0 if (exonPos == 0) continue; // printf(" snp %s at %d\n", snp->name, snp->chromStart); // printf(" exonPos = %d\n", exonPos); startPos = findStartPos(FLANKSIZE, snp->chromStart, gene, exonPos); endPos = findEndPos(FLANKSIZE, snp->chromStart, gene, exonPos); // printf("flank start = %d, flank end = %d\n", startPos, endPos); printExons(snp->name, gene, chromName, startPos, endPos, seq); } snpFreeList(&snps); } geneFreeList(&genes); }