Skip to main content
. 2020 Feb 18;5(1):e00903-19. doi: 10.1128/mSystems.00903-19

TABLE 4.

Pseudocode for unbalanced graphs (algorithm 3)a

Step Description
1 G ← original graph
2 K ← no. of subgraphs to generate
3 F ← no. of edges to subsample
4 R ← fraction of subgraphs where edges need to be stable
5 for k = 1 to K do
6     sample F edges from G to create g
7     if components in g are balanced then
8         for component in g do
9             B apply algorithm 2 on component
10         end
11     M[k] scoring matrix initialized from g
12     M[k]M[k]2
13     M[k] apply algorithm 1 on M[k]
14     for row, column in M[k] do
15     M[k]row,columnM[k]row,column+1/M[k]row,column
16     end
17     M[k] apply algorithm 1 on M[k]
18     M[k]M[k]+B
19     M[k] apply algorithm 1 on M[k]
20 end
21 O ← empty matrix
22 for row, column in M do
23     p0
24     n0
25     for k = 1 to K do
26         if M[k]row,column>0 then
27             pp+1
28         else if M[k]row,column<0 then
29             nn+1
30     if p/K>R or if n/K>R then
31         for k = 1 to K do
32             Orow,columnOrow,column+M[k]row,column
33         end
34 end
35 OO/max[abs(O)]
a

Pseudocode operators “while,” “for,” “if,” “or,” “else,” “then,” “do,” and “end” are highlighted in bold for clarity.