Compare commits
No commits in common. "06690e4982cf993da4e18dacd44458c04fde32e0" and "19119a5adfede51863decf8b80f70f32b311dc15" have entirely different histories.
06690e4982
...
19119a5adf
@ -36,8 +36,6 @@ Usage: ./SOCgen -n <order> [-r <num>] [--graphviz] [FILTER ...]
|
|||||||
-n <order> Generate SOCs with `order' connected nodes
|
-n <order> Generate SOCs with `order' connected nodes
|
||||||
-r <num> Pick directed graphs at random, and exit after having found `num' SOCs
|
-r <num> Pick directed graphs at random, and exit after having found `num' SOCs
|
||||||
--graphviz Output SOCs in Graphviz format, arcs of common parents are highlighted
|
--graphviz Output SOCs in Graphviz format, arcs of common parents are highlighted
|
||||||
--vector Output SOCs adjacency vectors in the order (0<-1, 0<-2, ..., 1<-0, 1<-2, ...)
|
|
||||||
--all Allow for disconnected SOCs and disable the degree-order filter (see below)
|
|
||||||
|
|
||||||
[FILTER] Consider only simple directed graphs ...
|
[FILTER] Consider only simple directed graphs ...
|
||||||
-c ... that are cyclic (i.e., not DAGs)
|
-c ... that are cyclic (i.e., not DAGs)
|
||||||
@ -45,7 +43,7 @@ Usage: ./SOCgen -n <order> [-r <num>] [--graphviz] [FILTER ...]
|
|||||||
--no-source ... without source nodes (also this logically implies -c)
|
--no-source ... without source nodes (also this logically implies -c)
|
||||||
|
|
||||||
This program prints the found SOCs as adjacency matrices to stdout, unless --graphviz has been specified.
|
This program prints the found SOCs as adjacency matrices to stdout, unless --graphviz has been specified.
|
||||||
To exclude (some) of the isomorphic SOCs, it uses a degree-order filter, unless --all is specified.
|
To exclude (some) of the isomorphic SOCs, it uses a degree-order filter.
|
||||||
```
|
```
|
||||||
|
|
||||||
### SOCadmissible
|
### SOCadmissible
|
||||||
|
30
src/SOCgen.c
30
src/SOCgen.c
@ -32,30 +32,6 @@ void dumpgraph(int n, const int *children, const int *childrenlen) {
|
|||||||
printf("}\n");
|
printf("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Print the graph's adjacency vector.
|
|
||||||
* The entries are (0<-1, 0<-2, ...1, 1<-0, 1<-2, ...)
|
|
||||||
***/
|
|
||||||
void dumpgraphvector(int n, const int *parents, const int *parentslen) {
|
|
||||||
int edge = 0;
|
|
||||||
for (int a = 0; a < n; a++) {
|
|
||||||
for (int b = 0; b < n; b++) {
|
|
||||||
if (a==b) continue;
|
|
||||||
edge = 0;
|
|
||||||
for (int i = 0; i < parentslen[a] && !edge; i++) {
|
|
||||||
const int v = parents[a*n+i];
|
|
||||||
if (b==v) {
|
|
||||||
printf("1");
|
|
||||||
edge = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!edge)
|
|
||||||
printf("0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Print the graph as graphviz command
|
* Print the graph as graphviz command
|
||||||
***/
|
***/
|
||||||
@ -484,7 +460,6 @@ int main(int argc, char *argv[]) {
|
|||||||
int NOSOURCE = 0;
|
int NOSOURCE = 0;
|
||||||
int RANDOM = 0;
|
int RANDOM = 0;
|
||||||
int GRAPHVIZ = 0;
|
int GRAPHVIZ = 0;
|
||||||
int VECTOR = 0;
|
|
||||||
int UNKOPTION = 0;
|
int UNKOPTION = 0;
|
||||||
int ALL = 0;
|
int ALL = 0;
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
@ -504,8 +479,6 @@ int main(int argc, char *argv[]) {
|
|||||||
GRAPHVIZ = 1;
|
GRAPHVIZ = 1;
|
||||||
} else if (strcmp(argv[i], "--all") == 0) {
|
} else if (strcmp(argv[i], "--all") == 0) {
|
||||||
ALL = 1;
|
ALL = 1;
|
||||||
} else if (strcmp(argv[i], "--vector") == 0) {
|
|
||||||
VECTOR = 1;
|
|
||||||
} else {
|
} else {
|
||||||
UNKOPTION = 1;
|
UNKOPTION = 1;
|
||||||
break;
|
break;
|
||||||
@ -516,7 +489,6 @@ int main(int argc, char *argv[]) {
|
|||||||
fprintf(stderr, " -n <order> Generate SOCs with `order' connected nodes\n");
|
fprintf(stderr, " -n <order> Generate SOCs with `order' connected nodes\n");
|
||||||
fprintf(stderr, " -r <num> Pick directed graphs at random, and exit after having found `num' SOCs\n");
|
fprintf(stderr, " -r <num> Pick directed graphs at random, and exit after having found `num' SOCs\n");
|
||||||
fprintf(stderr, " --graphviz Output SOCs in Graphviz format, arcs of common parents are highlighted\n");
|
fprintf(stderr, " --graphviz Output SOCs in Graphviz format, arcs of common parents are highlighted\n");
|
||||||
fprintf(stderr, " --vector Output SOCs adjacency vectors in the order (0<-1, 0<-2, ..., 1<-0, 1<-2, ...)\n");
|
|
||||||
fprintf(stderr, " --all Allow for disconnected SOCs and disable the degree-order filter (see below)\n");
|
fprintf(stderr, " --all Allow for disconnected SOCs and disable the degree-order filter (see below)\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "[FILTER] Consider only simple directed graphs ...\n");
|
fprintf(stderr, "[FILTER] Consider only simple directed graphs ...\n");
|
||||||
@ -633,8 +605,6 @@ int main(int argc, char *argv[]) {
|
|||||||
len++;
|
len++;
|
||||||
if (GRAPHVIZ)
|
if (GRAPHVIZ)
|
||||||
dumpgv(n, graphnumber, children, childrenlen);
|
dumpgv(n, graphnumber, children, childrenlen);
|
||||||
else if (VECTOR)
|
|
||||||
dumpgraphvector(n, parents, parentslen);
|
|
||||||
else
|
else
|
||||||
dumpgraph(n, children, childrenlen);
|
dumpgraph(n, children, childrenlen);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user