Created
August 13, 2012 20:50
-
-
Save hilverd/3343995 to your computer and use it in GitHub Desktop.
Topological sort in Graphviz's gvpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
int visited[node_t]; | |
int visit(node_t n, edge_t e) { | |
if (visited[n] == 0) { | |
visited[n] = 1; | |
for (e = fstin(n); e; e = nxtin(e)) { | |
visit(e.tail, NULL); | |
} | |
printf("%s\n", n.name); | |
} | |
return 0; | |
} | |
} | |
N { | |
visit($, NULL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment