removed need of R igraph from chlorodb/subdb
Former-commit-id: 574aace9be5804d728a877110f5f475d61644f75 Former-commit-id: 2e7ea63447643830a62f18a364327d7b396ec140
This commit is contained in:
31
detectors/cds/tools/chlorodb/subdb/lib/db.cc.awk
Normal file
31
detectors/cds/tools/chlorodb/subdb/lib/db.cc.awk
Normal file
@ -0,0 +1,31 @@
|
||||
#
|
||||
#
|
||||
|
||||
function visit(u, i, _local_, v) {
|
||||
if (Visited[u]) return
|
||||
Visited[u] = i
|
||||
for (v in Edge[u]) {
|
||||
visit(v, i)
|
||||
}
|
||||
}
|
||||
|
||||
/^#/ { next }
|
||||
|
||||
{
|
||||
Node[$1]++
|
||||
Node[$2]++
|
||||
Edge[$1][$2]++
|
||||
Edge[$2][$1]++
|
||||
}
|
||||
|
||||
END {
|
||||
|
||||
for (u in Node) {
|
||||
if (Visited[u]) continue
|
||||
visit(u, ++NbComp)
|
||||
}
|
||||
|
||||
for (u in Node)
|
||||
print u, Visited[u]
|
||||
|
||||
}
|
Reference in New Issue
Block a user