Triangle Counting in Large Sparse Graph Meng-Tsung Tsai - - PowerPoint PPT Presentation

triangle counting in large sparse graph
SMART_READER_LITE
LIVE PREVIEW

Triangle Counting in Large Sparse Graph Meng-Tsung Tsai - - PowerPoint PPT Presentation

Triangle Counting in Large Sparse Graph Meng-Tsung Tsai r95065@cise.ntu.edu.tw Triangle Counting in Large Sparse Graph p.1/31 Problem Setting Triangle Counting in Large Sparse Graph p.2/31 Problem Setting(1/3) Goal : Calculating the


slide-1
SLIDE 1

Triangle Counting in Large Sparse Graph

Meng-Tsung Tsai r95065@cise.ntu.edu.tw

Triangle Counting in Large Sparse Graph – p.1/31

slide-2
SLIDE 2

Problem Setting

Triangle Counting in Large Sparse Graph – p.2/31

slide-3
SLIDE 3

Problem Setting(1/3)

Goal: Calculating the cluster coefficient of a given graph G(V, E), where |V | = n and |E| = m.

Triangle Counting in Large Sparse Graph – p.3/31

slide-4
SLIDE 4

Problem Setting(1/3)

Goal: Calculating the cluster coefficient of a given graph G(V, E), where |V | = n and |E| = m. Cluster coefficient indicates the probability that the friend of one’s friend is also one’s friend.

Triangle Counting in Large Sparse Graph – p.3/31

slide-5
SLIDE 5

Problem Setting(1/3)

Goal: Calculating the cluster coefficient of a given graph G(V, E), where |V | = n and |E| = m. Cluster coefficient indicates the probability that the friend of one’s friend is also one’s friend. Cluster coefficient is one of the important features to examine whether a man-made graph fits to the real

  • ne.

Triangle Counting in Large Sparse Graph – p.3/31

slide-6
SLIDE 6

Problem Setting(1/3)

Goal: Calculating the cluster coefficient of a given graph G(V, E), where |V | = n and |E| = m. Cluster coefficient indicates the probability that the friend of one’s friend is also one’s friend. Cluster coefficient is one of the important features to examine whether a man-made graph fits to the real

  • ne.

In terms of graph theory, CC(G) = 3 × number of triangles ∈ G

number of triples ∈ G

.

Triangle Counting in Large Sparse Graph – p.3/31

slide-7
SLIDE 7

Problem Setting(1/3)

Goal: Calculating the cluster coefficient of a given graph G(V, E), where |V | = n and |E| = m. Cluster coefficient indicates the probability that the friend of one’s friend is also one’s friend. Cluster coefficient is one of the important features to examine whether a man-made graph fits to the real

  • ne.

In terms of graph theory, CC(G) = 3 × number of triangles ∈ G

number of triples ∈ G

. triple

✉ ✉ ✉ ✔ ✔ ❚ ❚

triangle

✉ ✉ ✉ ✔ ✔ ❚ ❚

Triangle Counting in Large Sparse Graph – p.3/31

slide-8
SLIDE 8

Problem Setting(2/3)

Example:

✔ ✔ ✔ ❚ ❚ ❚ ❵❵ ❵ ✟✟✟✟ ✟ ✁ ✁ ✁ ③ ③ ③ ③

Triangle Counting in Large Sparse Graph – p.4/31

slide-9
SLIDE 9

Problem Setting(2/3)

Example:

✔ ✔ ✔ ❚ ❚ ❚ ❵❵ ❵ ✟✟✟✟ ✟ ✁ ✁ ✁ ③ ③ ③ ③

number of triangle = 2

Triangle Counting in Large Sparse Graph – p.4/31

slide-10
SLIDE 10

Problem Setting(2/3)

Example:

✔ ✔ ✔ ❚ ❚ ❚ ❵❵ ❵ ✟✟✟✟ ✟ ✁ ✁ ✁ ③ ③ ③ ③

number of triangle = 2 number of triple = 8

Triangle Counting in Large Sparse Graph – p.4/31

slide-11
SLIDE 11

Problem Setting(2/3)

Example:

✔ ✔ ✔ ❚ ❚ ❚ ❵❵ ❵ ✟✟✟✟ ✟ ✁ ✁ ✁ ③ ③ ③ ③

number of triangle = 2 number of triple = 8 cluster coefficient = 3 × 2 / 8 = 0.75

Triangle Counting in Large Sparse Graph – p.4/31

slide-12
SLIDE 12

Problem Setting(2/3)

Example:

✔ ✔ ✔ ❚ ❚ ❚ ❵❵ ❵ ✟✟✟✟ ✟ ✁ ✁ ✁ ③ ③ ③ ③

number of triangle = 2 number of triple = 8 cluster coefficient = 3 × 2 / 8 = 0.75 Triple counting is easy; therefore, the main difficulty to calculate CC(G) is triangle counting.

Triangle Counting in Large Sparse Graph – p.4/31

slide-13
SLIDE 13

Problem Setting(3/3)

Requirement: Seeking for an efficient algorithm to count the number of triangles such that it takes Ω(m) space and Ω(n3) time.

Triangle Counting in Large Sparse Graph – p.5/31

slide-14
SLIDE 14

Problem Setting(3/3)

Requirement: Seeking for an efficient algorithm to count the number of triangles such that it takes Ω(m) space and Ω(n3) time. We focus on social network graphs which cluster coefficient is especially important in.

Triangle Counting in Large Sparse Graph – p.5/31

slide-15
SLIDE 15

Problem Setting(3/3)

Requirement: Seeking for an efficient algorithm to count the number of triangles such that it takes Ω(m) space and Ω(n3) time. We focus on social network graphs which cluster coefficient is especially important in. In social network, the fact that m = ω(n2) usually holds.

Triangle Counting in Large Sparse Graph – p.5/31

slide-16
SLIDE 16

Triangle Counting (Trivial Algorithm)

Triangle Counting in Large Sparse Graph – p.6/31

slide-17
SLIDE 17

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v

Triangle Counting in Large Sparse Graph – p.7/31

slide-18
SLIDE 18

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

Triangle Counting in Large Sparse Graph – p.7/31

slide-19
SLIDE 19

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v

Triangle Counting in Large Sparse Graph – p.7/31

slide-20
SLIDE 20

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

Triangle Counting in Large Sparse Graph – p.7/31

slide-21
SLIDE 21

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

Triangle Counting in Large Sparse Graph – p.7/31

slide-22
SLIDE 22

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

Let M be a matrix such that Mi,j is 1 iff an edge to connect vertices i and j exists.

Triangle Counting in Large Sparse Graph – p.7/31

slide-23
SLIDE 23

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

Let M be a matrix such that Mi,j is 1 iff an edge to connect vertices i and j exists. Let M 2 be M · M. What does M 2

i,j mean?

Triangle Counting in Large Sparse Graph – p.7/31

slide-24
SLIDE 24

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

Let M be a matrix such that Mi,j is 1 iff an edge to connect vertices i and j exists. Let M 2 be M · M. What does M 2

i,j mean?

△ = 1 6 M 2

i,j · Mi,j

Triangle Counting in Large Sparse Graph – p.7/31

slide-25
SLIDE 25

Trivial Algorithm

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

u v +

③ ③

u v =

③ ③ ③ ✔ ✔ ✔ ❚ ❚ ❚

Let M be a matrix such that Mi,j is 1 iff an edge to connect vertices i and j exists. Let M 2 be M · M. What does M 2

i,j mean?

△ = 1 6 M 2

i,j · Mi,j

Simple Matrix Multiplication, Strassen Algorithm, and Winograd Algorithm all require O(n2) space to

  • btain M 2. Not Acceptable!

Triangle Counting in Large Sparse Graph – p.7/31

slide-26
SLIDE 26

Triangle Counting (Forward Algorithm)

Triangle Counting in Large Sparse Graph – p.8/31

slide-27
SLIDE 27

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

Triangle Counting in Large Sparse Graph – p.9/31

slide-28
SLIDE 28

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4

Triangle Counting in Large Sparse Graph – p.9/31

slide-29
SLIDE 29

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3}

Triangle Counting in Large Sparse Graph – p.9/31

slide-30
SLIDE 30

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1}

Triangle Counting in Large Sparse Graph – p.9/31

slide-31
SLIDE 31

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1} △ =

edge(u,v)∈E|Nu ∩ Nv|

Triangle Counting in Large Sparse Graph – p.9/31

slide-32
SLIDE 32

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1} △ =

edge(u,v)∈E|Nu ∩ Nv|

all triangles can be found

Triangle Counting in Large Sparse Graph – p.9/31

slide-33
SLIDE 33

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1} △ =

edge(u,v)∈E|Nu ∩ Nv|

all triangles can be found + all found objects are triangles

Triangle Counting in Large Sparse Graph – p.9/31

slide-34
SLIDE 34

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1}

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

4 2 3 1 △ =

edge(u,v)∈E|Nu ∩ Nv|

all triangles can be found + all found objects are triangles

Triangle Counting in Large Sparse Graph – p.9/31

slide-35
SLIDE 35

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1}

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

4 2 3 1 {1, 2} {1} {1, 2} {} △ =

edge(u,v)∈E|Nu ∩ Nv|

all triangles can be found + all found objects are triangles

Triangle Counting in Large Sparse Graph – p.9/31

slide-36
SLIDE 36

Forward Algorithm(1/2)

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

1 2 3 4 {} {1} {2} {1, 2, 3} {1} ∩ {1, 2, 3} = {1}

✔ ✔ ✔ ✔ ✔ ✔ ❚ ❚ ❚ ❚ ❚ ❚ ❵❵❵❵❵ ❵ ✟✟✟✟✟✟✟✟✟ ✟ ✁ ✁ ✁ ✁ ✁ ⑦ ⑦ ⑦ ⑦

4 2 3 1 {1, 2} {1} {1, 2} {} △ =

edge(u,v)∈E|Nu ∩ Nv|

all triangles can be found + all found objects are triangles time: O(m · d(G)), space: Θ(m)

Triangle Counting in Large Sparse Graph – p.9/31

slide-37
SLIDE 37

Forward Algorithm(2/2)

Assign indices to vertices according to their degree. The higher the degree of a vertex is, the lower the index of it is.

Triangle Counting in Large Sparse Graph – p.10/31

slide-38
SLIDE 38

Forward Algorithm(2/2)

Assign indices to vertices according to their degree. The higher the degree of a vertex is, the lower the index of it is. If degree of vertex v ≤ √ 2m, |Nv| ≤ √ 2m.

Triangle Counting in Large Sparse Graph – p.10/31

slide-39
SLIDE 39

Forward Algorithm(2/2)

Assign indices to vertices according to their degree. The higher the degree of a vertex is, the lower the index of it is. If degree of vertex v ≤ √ 2m, |Nv| ≤ √ 2m. If degree of vertex v >= k, at most 2m/k vertices with higher degree. Thus, |Nv| <= √ 2m where deg(v) ≥ √ 2m.

Triangle Counting in Large Sparse Graph – p.10/31

slide-40
SLIDE 40

Forward Algorithm(2/2)

Assign indices to vertices according to their degree. The higher the degree of a vertex is, the lower the index of it is. If degree of vertex v ≤ √ 2m, |Nv| ≤ √ 2m. If degree of vertex v >= k, at most 2m/k vertices with higher degree. Thus, |Nv| <= √ 2m where deg(v) ≥ √ 2m. There exists another algorithm to find the optimum solution

  • f d(G) in O(m) time.

Triangle Counting in Large Sparse Graph – p.10/31

slide-41
SLIDE 41

Triangle Counting (Four Russians’ Algorithm)

Triangle Counting in Large Sparse Graph – p.11/31

slide-42
SLIDE 42

Four-Russians’ Algorithm

{1, 0, 1, 1, . . .} {0, 1, 0, 0, . . .} . . .

Triangle Counting in Large Sparse Graph – p.12/31

slide-43
SLIDE 43

Four-Russians’ Algorithm

{

sector

  • 1, 0, 1, 1, . . .}

{2, 3, . . .} {0, 1, 0, 0, . . .} {1, 0, . . .} . . . . . .

Triangle Counting in Large Sparse Graph – p.12/31

slide-44
SLIDE 44

Four-Russians’ Algorithm

{

sector

  • 1, 0, 1, 1, . . .}

{2, 3, . . .} {0, 1, 0, 0, . . .} {1, 0, . . .} . . . . . . 1 2 3 1 1 1 2 1 1 3 1 1 2

Triangle Counting in Large Sparse Graph – p.12/31

slide-45
SLIDE 45

Four-Russians’ Algorithm

{

sector

  • 1, 0, 1, 1, . . .}

{2, 3, . . .} {0, 1, 0, 0, . . .} {1, 0, . . .} . . . . . . 1 2 3 1 1 1 2 1 1 3 1 1 2 The table utilized in Four-Russians’ Algorithm is 2log n by 2log n. Thus, its speedup is O(log n).

Triangle Counting in Large Sparse Graph – p.12/31

slide-46
SLIDE 46

Triangle Counting (FFR Algorithm)

Triangle Counting in Large Sparse Graph – p.13/31

slide-47
SLIDE 47

FFR Algorithm

The red part of △ =

edge(u,v)∈E |Nu ∩ Nv| in Forward

Algorithm can be sped up with Four-Russians’ Algorithm.

Triangle Counting in Large Sparse Graph – p.14/31

slide-48
SLIDE 48

FFR Algorithm

The red part of △ =

edge(u,v)∈E |Nu ∩ Nv| in Forward

Algorithm can be sped up with Four-Russians’ Algorithm. Let the length of sectors be 1

2 log m, additional space

for table is Θ(m).

Triangle Counting in Large Sparse Graph – p.14/31

slide-49
SLIDE 49

FFR Algorithm

The red part of △ =

edge(u,v)∈E |Nu ∩ Nv| in Forward

Algorithm can be sped up with Four-Russians’ Algorithm. Let the length of sectors be 1

2 log m, additional space

for table is Θ(m). The number of non-all-zero sectors in Nv is O(

  • m/ log m) where deg(v) ≤
  • m/ log m.

Triangle Counting in Large Sparse Graph – p.14/31

slide-50
SLIDE 50

FFR Algorithm

The red part of △ =

edge(u,v)∈E |Nu ∩ Nv| in Forward

Algorithm can be sped up with Four-Russians’ Algorithm. Let the length of sectors be 1

2 log m, additional space

for table is Θ(m). The number of non-all-zero sectors in Nv is O(

  • m/ log m) where deg(v) ≤
  • m/ log m.

The number of non-all-zero sectors in Nv is O(

  • m/ log m) where deg(v) ≥
  • m/ log m.

Triangle Counting in Large Sparse Graph – p.14/31

slide-51
SLIDE 51

FFR Algorithm

The red part of △ =

edge(u,v)∈E |Nu ∩ Nv| in Forward

Algorithm can be sped up with Four-Russians’ Algorithm. Let the length of sectors be 1

2 log m, additional space

for table is Θ(m). The number of non-all-zero sectors in Nv is O(

  • m/ log m) where deg(v) ≤
  • m/ log m.

The number of non-all-zero sectors in Nv is O(

  • m/ log m) where deg(v) ≥
  • m/ log m.

FFR needs O(m3/2/ log1/2 m) time.

Triangle Counting in Large Sparse Graph – p.14/31

slide-52
SLIDE 52

CPU Instruction versus Memory Access

Triangle Counting in Large Sparse Graph – p.15/31

slide-53
SLIDE 53

Instruction versus Memory(1/3)

The inner product in Four-Russians’ Algorithm can be accomplished by two CPU instructions. It is known that the execution speed of CPU instruction is much faster than that of memory access.

Triangle Counting in Large Sparse Graph – p.16/31

slide-54
SLIDE 54

Instruction versus Memory(1/3)

The inner product in Four-Russians’ Algorithm can be accomplished by two CPU instructions. It is known that the execution speed of CPU instruction is much faster than that of memory access. "logical and" C = A˚ ∧ B, Ci = min(Ai, Bi)

Triangle Counting in Large Sparse Graph – p.16/31

slide-55
SLIDE 55

Instruction versus Memory(1/3)

The inner product in Four-Russians’ Algorithm can be accomplished by two CPU instructions. It is known that the execution speed of CPU instruction is much faster than that of memory access. "logical and" C = A˚ ∧ B, Ci = min(Ai, Bi) "population count" d = ˚ σ A, d = g

i=1 Ai

Triangle Counting in Large Sparse Graph – p.16/31

slide-56
SLIDE 56

Instruction versus Memory(2/3)

2 2.5 3 3.5 4 10 20 30 40 50 60 wall time (second per 10,000 runs) bit density (x out of 64 bits are 1) ALGO 5 ALGO 2 with p= 8 ALGO 2 with p=16

Triangle Counting in Large Sparse Graph – p.17/31

slide-57
SLIDE 57

Instruction versus Memory(2/3)

5 10 15 20 25 30 10 20 30 40 50 60 wall time (second per 10,000 runs) bit density (x out of 64 bits are 1) ALGO 2 with p= 8 ALGO 2 with p=16 ALGO 2 with p=22

Triangle Counting in Large Sparse Graph – p.17/31

slide-58
SLIDE 58

Instruction versus Memory(3/3)

CPU instructions can handle sectors of size g, where g is the length of CPU register.

Triangle Counting in Large Sparse Graph – p.18/31

slide-59
SLIDE 59

Instruction versus Memory(3/3)

CPU instructions can handle sectors of size g, where g is the length of CPU register. Is g a constant in the analysis of algorithm?

Triangle Counting in Large Sparse Graph – p.18/31

slide-60
SLIDE 60

Instruction versus Memory(3/3)

CPU instructions can handle sectors of size g, where g is the length of CPU register. Is g a constant in the analysis of algorithm? Are all instructions O(1)-executable?

Triangle Counting in Large Sparse Graph – p.18/31

slide-61
SLIDE 61

Is g a constant?

Triangle Counting in Large Sparse Graph – p.19/31

slide-62
SLIDE 62

Is g a constant?

Triangle Counting in Large Sparse Graph – p.20/31

slide-63
SLIDE 63

Is g a constant?

Assume a program executed on M, a random access machine, using Θ(S) memory space.

Triangle Counting in Large Sparse Graph – p.20/31

slide-64
SLIDE 64

Is g a constant?

Assume a program executed on M, a random access machine, using Θ(S) memory space. Θ(S) memory address is required.

Triangle Counting in Large Sparse Graph – p.20/31

slide-65
SLIDE 65

Is g a constant?

Assume a program executed on M, a random access machine, using Θ(S) memory space. Θ(S) memory address is required. The length of the registers in M is Ω(log S).

Triangle Counting in Large Sparse Graph – p.20/31

slide-66
SLIDE 66

Are all instructions O(1)-executable?

Triangle Counting in Large Sparse Graph – p.21/31

slide-67
SLIDE 67

Are all instructions O(1)-executable?

Triangle Counting in Large Sparse Graph – p.22/31

slide-68
SLIDE 68

Are all instructions O(1)-executable?

AC0 instructions are those which can be realized with polynomial size and constant depth circuit.

Triangle Counting in Large Sparse Graph – p.22/31

slide-69
SLIDE 69

Are all instructions O(1)-executable?

AC0 instructions are those which can be realized with polynomial size and constant depth circuit. Multiplication is not an AC0 instruction.

Triangle Counting in Large Sparse Graph – p.22/31

slide-70
SLIDE 70

Are all instructions O(1)-executable?

AC0 instructions are those which can be realized with polynomial size and constant depth circuit. Multiplication is not an AC0 instruction. To access multi-dimension array in constant time, multiplication must be constant time executable.

Triangle Counting in Large Sparse Graph – p.22/31

slide-71
SLIDE 71

Are all instructions O(1)-executable?

AC0 instructions are those which can be realized with polynomial size and constant depth circuit. Multiplication is not an AC0 instruction. To access multi-dimension array in constant time, multiplication must be constant time executable. We suggest those instructions can be implemented faster than multiplication is constant time executable.

Triangle Counting in Large Sparse Graph – p.22/31

slide-72
SLIDE 72

Population Count

Triangle Counting in Large Sparse Graph – p.23/31

slide-73
SLIDE 73

Population Count(1/3)

Triangle Counting in Large Sparse Graph – p.24/31

slide-74
SLIDE 74

Population Count(1/3)

˚ σ is not supported by all types of CPU.

Triangle Counting in Large Sparse Graph – p.24/31

slide-75
SLIDE 75

Population Count(1/3)

˚ σ is not supported by all types of CPU. Any alternative way?

Triangle Counting in Large Sparse Graph – p.24/31

slide-76
SLIDE 76

Population Count(1/3)

˚ σ is not supported by all types of CPU. Any alternative way? The previous work shows a bitwise twiddling method to realize the population count. The method needs O(log(2) g) basic instructions. Hence, the speedup is O(g1/2/ log(2) g) = Ω(log1/2 m/ log(3) m) due to g = Ω(log m).

Triangle Counting in Large Sparse Graph – p.24/31

slide-77
SLIDE 77

Population Count(1/3)

˚ σ is not supported by all types of CPU. Any alternative way? The previous work shows a bitwise twiddling method to realize the population count. The method needs O(log(2) g) basic instructions. Hence, the speedup is O(g1/2/ log(2) g) = Ω(log1/2 m/ log(3) m) due to g = Ω(log m). Any faster solution?

Triangle Counting in Large Sparse Graph – p.24/31

slide-78
SLIDE 78

Population Count(1/3)

˚ σ is not supported by all types of CPU. Any alternative way? The previous work shows a bitwise twiddling method to realize the population count. The method needs O(log(2) g) basic instructions. Hence, the speedup is O(g1/2/ log(2) g) = Ω(log1/2 m/ log(3) m) due to g = Ω(log m). Any faster solution? To calculate a collective of population counts, shall we execute each population count exactly?

Triangle Counting in Large Sparse Graph – p.24/31

slide-79
SLIDE 79

Population Count(2/3)

{ 1 1 } { 1 1 } { 1 1 }

Triangle Counting in Large Sparse Graph – p.25/31

slide-80
SLIDE 80

Population Count(2/3)

{ 1 1 } { 1 1 } + { 1 1 } 20 { 1 1 } 21 { 1 1 }

Triangle Counting in Large Sparse Graph – p.25/31

slide-81
SLIDE 81

Population Count(2/3)

{ 1 1 } { 1 1 } + { 1 1 } 20 { 1 1 } 21 { 1 1 } Using this method to reduce 2d − 1 ˚ σ into d ˚ σ.

Triangle Counting in Large Sparse Graph – p.25/31

slide-82
SLIDE 82

Population Count(2/3)

{ 1 1 } { 1 1 } + { 1 1 } 20 { 1 1 } 21 { 1 1 } Using this method to reduce 2d − 1 ˚ σ into d ˚ σ. The speedup is Ω(log1/2 m/ log(4) m).

Triangle Counting in Large Sparse Graph – p.25/31

slide-83
SLIDE 83

Instruction versus Memory(2/3)

0.5 1 1.5 2 2.5 3 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 elapsed wall time (second) rewiring probability ALGO 3 ALGO 7[12 <- ALGO 10] ALGO 7[12 <- ALGO 12]

Triangle Counting in Large Sparse Graph – p.26/31

slide-84
SLIDE 84

Instruction versus Memory(2/3)

20 40 60 80 100 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 speedup relative to ALGO 3(%) rewiring probability ALGO 7[12 <- ALGO 10] ALGO 7[12 <- ALGO 12]

Triangle Counting in Large Sparse Graph – p.26/31

slide-85
SLIDE 85

Conclusion

Triangle Counting in Large Sparse Graph – p.27/31

slide-86
SLIDE 86

Conclusion

Triangle Counting in Large Sparse Graph – p.28/31

slide-87
SLIDE 87

Conclusion

Previous efficient algorithm, Forward Algorithm, needs O(m3/2) time and O(m) space.

Triangle Counting in Large Sparse Graph – p.28/31

slide-88
SLIDE 88

Conclusion

Previous efficient algorithm, Forward Algorithm, needs O(m3/2) time and O(m) space. To develop algorithms on random access machines, we come up with two arguments.

Triangle Counting in Large Sparse Graph – p.28/31

slide-89
SLIDE 89

Conclusion

Previous efficient algorithm, Forward Algorithm, needs O(m3/2) time and O(m) space. To develop algorithms on random access machines, we come up with two arguments. Based on the arguments, our algorithm has Ω(log1/2 m/ log(4) m) speedup.

Triangle Counting in Large Sparse Graph – p.28/31

slide-90
SLIDE 90

Conclusion

Previous efficient algorithm, Forward Algorithm, needs O(m3/2) time and O(m) space. To develop algorithms on random access machines, we come up with two arguments. Based on the arguments, our algorithm has Ω(log1/2 m/ log(4) m) speedup. Though it may slightly worse than FFR Algorithm in the analysis of speedup, it performs better in practical.

Triangle Counting in Large Sparse Graph – p.28/31

slide-91
SLIDE 91

Future Work

Triangle Counting in Large Sparse Graph – p.29/31

slide-92
SLIDE 92

Future Work

Triangle Counting in Large Sparse Graph – p.30/31

slide-93
SLIDE 93

Future Work

Maybe some graph features are more proper to analyze than degeneracy when the algorithm to calculate the intersection of given two sets changed.

Triangle Counting in Large Sparse Graph – p.30/31

slide-94
SLIDE 94

Future Work

Maybe some graph features are more proper to analyze than degeneracy when the algorithm to calculate the intersection of given two sets changed. The same arguments on random access machines can be applied to many other algorithms.

Triangle Counting in Large Sparse Graph – p.30/31

slide-95
SLIDE 95

Thanks for your attention! Any Questions?

Triangle Counting in Large Sparse Graph – p.31/31