#define HELPTEXT \ " For each input, write to output if planar.\n\
\n\
The output file has a header ifand only if the input file does.\n\
\n\
-v Write non-planar graphs instead of planar graphs\n\
-V Write report on every input\n\
-u Don't write anything, just count\n\
-p Write in planar_code if planar (without -p, same format as input)\n\
-k Follow each non-planar output with an obstruction in sparse6\n\
format (implies -v, incompatible with -p)\n\
-n Suppress checking of the result\n\
-q Suppress auxiliary information\n\
\n\ This program permits multiple edges and loops\n"
if (bytes == 1)
{
j = 0;
PUT1(n); for (i = 0; i < n; ++i)
{
k = k0 = VR[i].first_edge; if (k != NIL) do
{
PUT1(A[ER[k].in_adjl].end_vertex+1);
k = ER[k].next;
} while (k != k0);
PUT1(0);
}
} elseif (bytes == 2)
{
j = 0;
PUT1(0);
PUT2(n); for (i = 0; i < n; ++i)
{
k = k0 = VR[i].first_edge; if (k != NIL) do
{
PUT2(A[ER[k].in_adjl].end_vertex+1);
k = ER[k].next;
} while (k != k0);
PUT2(0);
}
} else
{
j = 0;
PUT1(0);
PUT2(0);
PUT4(n); for (i = 0; i < n; ++i)
{
k = k0 = VR[i].first_edge; if (k != NIL) do
{
PUT4(A[ER[k].in_adjl].end_vertex+1);
k = ER[k].next;
} while (k != k0);
PUT4(0);
}
}
if (fwrite((void*)buff,1,len,f) != len)
{
fprintf(stderr,">E write_planarcode : error on writing\n");
ABORT(">E write_planarcode");
}
}
static boolean
isplanar(t_ver_sparse_rep *V, int n, t_adjl_sparse_rep *A, int e, int *c, t_ver_sparse_rep **VR, t_adjl_sparse_rep **AR,
t_embed_sparse_rep **ER, int *nbr_e_obs,
boolean planarcheck, boolean nonplanarcheck) /* The input graph is given as an adjacency list: V: array of vertices n: size of graph A: adjacency list e: number of edges If the graph is planar the embedding is stored in VR and ER; the embedding contains e edges (nbr_e_obs not used) If the graph is non planar the obstruction is returned in VR and AR together with the number of edges in nbr_e_obs.
In all cases the number of components is return in c.
planarcheck and nonplanarcheck determine if checking is done. The embedding and obstruction outputs are only made if the appropriate checking is done.
*/
{
t_dlcl **dfs_tree, **back_edges, **mult_edges; int edge_pos, v, w;
boolean ans;
t_ver_edge *embed_graph;
ans = sparseg_adjl_is_planar(V, n, A, c,
&dfs_tree, &back_edges, &mult_edges,
&embed_graph, &edge_pos, &v, &w);
if (!ans && nonplanarcheck)
{
embedg_obstruction(V, A, dfs_tree, back_edges,
embed_graph, n, &edge_pos,
v, w, VR, AR, nbr_e_obs);
} elseif (planarcheck)
{
embedg_embedding(V, A, embed_graph, n, e, *c, edge_pos, mult_edges,
VR, ER);
}
if (badargs)
{
fprintf(stderr,">E Usage: %s\n",USAGE); exit(1);
}
if (planarcode && nonplanar)
{
fprintf(stderr,">E planarg: -p and -v are incompatible\n"); exit(1);
}
if (!quiet)
{
fprintf(stderr,">A planarg"); if (nonplanar||planarcode||nowrite||nocheck)
fprintf(stderr," -"); if (nonplanar) fprintf(stderr,"v"); if (nowrite) fprintf(stderr,"u"); if (planarcode) fprintf(stderr,"p"); if (nocheck) fprintf(stderr,"n"); if (argnum > 0) fprintf(stderr," %s",infilename); if (argnum > 1) fprintf(stderr," %s",outfilename);
fprintf(stderr,"\n");
fflush(stderr);
}
if (infilename && infilename[0] == '-') infilename = NULL;
infile = opengraphfile(infilename,&codetype,FALSE,1); if (!infile) exit(1); if (!infilename) infilename = "stdin";
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.