Abstract

The purpose of this document is to serve as an introduction to network theory and analysis. The analysis portion will be aimed to identify the structure and modularity of a bipartite network.

Introduction

The objectives of identifying the structure and modularity of the bipartite network will assist us in finding the boundaries within the network. This information can help identify both strong and weak connections within a network and aide in the development of plans to strengthen it. Libraries used for this assignment will include igraph, bipartite, lpBrim, and many others. these libraries will provide the modularity maximization methods necessary to detect communities within bipartite networks.

Comparison of Methods for the Detection of Node Group Membership in Bipartite Networks

The analysis of real-world networks is aimed to find patterns and trends among the actors of the network. Knowing how each actor of the network contributes to cliques and patterns can benefit the network by providing a fine-tuned representation of the network. It has been found that modularity maximization methods are best for detecting communities in a network. By identifying the network’s modularity, one can identify the dense connections between nodes in different modules that will help identify ways to improve network connectivity (Sawardecker et al, 2009). More specifically, it has been found that both modularity maximization methods SA and BRIM achieve the highest accuracy when determining a network’s modularity structure. More detailed communities have been identified under the usage of this two algorithms (Sawardecker et al, 2009).

Description of Dataset(Background Research)

The dataset used for this assessment, ‘amazon0302’, is a bipartite data set that was extracted from Amazon.com through the technique of crawling. The first set of nodes are the numerical identification numbers of products from Amazon’s ‘Customers Who Bought This Item Also Bought’ tool (Leskovec, L. Adamic, B.Adamic, 2007). The prepared data set was downloaded from the Stanford Network Analysis Program website: https://snap.stanford.edu/data/amazon0302.html.

library(kableExtra)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.0.5     v dplyr   1.0.3
## v tidyr   1.1.2     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter()     masks stats::filter()
## x dplyr::group_rows() masks kableExtra::group_rows()
## x dplyr::lag()        masks stats::lag()
library(bipartite)
## Loading required package: vegan
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.5-7
## Loading required package: sna
## Loading required package: statnet.common
## 
## Attaching package: 'statnet.common'
## The following object is masked from 'package:base':
## 
##     order
## Loading required package: network
## network: Classes for Relational Data
## Version 1.16.1 created on 2020-10-06.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##                     Mark S. Handcock, University of California -- Los Angeles
##                     David R. Hunter, Penn State University
##                     Martina Morris, University of Washington
##                     Skye Bender-deMoll, University of Washington
##  For citation information, type citation("network").
##  Type help("network-package") to get started.
## sna: Tools for Social Network Analysis
## Version 2.6 created on 2020-10-5.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
##  This is bipartite 2.15.
##  For latest changes see versionlog in ?"bipartite-package". For citation see: citation("bipartite").
##  Have a nice time plotting and analysing two-mode networks.
## 
## Attaching package: 'bipartite'
## The following object is masked from 'package:vegan':
## 
##     nullmodel
library(ggnetwork)
library(igraph)
## 
## Attaching package: 'igraph'
## The following object is masked from 'package:bipartite':
## 
##     strength
## The following objects are masked from 'package:sna':
## 
##     betweenness, bonpow, closeness, components, degree, dyad.census,
##     evcent, hierarchy, is.connected, neighborhood, triad.census
## The following objects are masked from 'package:network':
## 
##     %c%, %s%, add.edges, add.vertices, delete.edges, delete.vertices,
##     get.edge.attribute, get.edges, get.vertex.attribute, is.bipartite,
##     is.directed, list.edge.attributes, list.vertex.attributes,
##     set.edge.attribute, set.vertex.attribute
## The following object is masked from 'package:vegan':
## 
##     diversity
## The following object is masked from 'package:permute':
## 
##     permute
## The following objects are masked from 'package:dplyr':
## 
##     as_data_frame, groups, union
## The following objects are masked from 'package:purrr':
## 
##     compose, simplify
## The following object is masked from 'package:tidyr':
## 
##     crossing
## The following object is masked from 'package:tibble':
## 
##     as_data_frame
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## The following object is masked from 'package:base':
## 
##     union
library(ggplot2)
library(network)
library(sna)

data = read.table("Amazon0302.txt", header = FALSE)
sub <- data%>%slice(1:1000)
kable(head(sub))
V1 V2
0 1
0 2
0 3
0 4
0 5
1 0
matrix = table(sub)

matrix = as.matrix(matrix)

#matrix

Explanation of Levels of Aggregataion(Evaluation)

The vertices of the bipartite network can be split into two independent sets of nodes such that every edge connects one vertex in set a to another vertex in set b. The closeness and betweenness of the network can be calculated to give insight on the modularity of the network. The closeness metric measures the length it would take to spread information throughout all nodes at once. The betweenness value measures the number of times one node serves as a bridge within the shortest path that connects two other nodes. Eigenvalues were implemented to find the covariance among the nodes of the network. This eigenvalues are plotted for each entry for visual representation.

closeness_w(matrix)
## Warning in as.tnet(net, type = "weighted one-mode tnet"): There were self-loops
## in the edgelist, these were removed
##        node    closeness  n.closeness
##   [1,]    5 0.0013531800 7.354239e-06
##   [2,]    6 0.0011641444 6.326871e-06
##   [3,]    7 0.0011792453 6.408942e-06
##   [4,]    8 0.0012919897 7.021683e-06
##   [5,]    9 0.0011641444 6.326871e-06
##   [6,]   10 0.0012285012 6.676637e-06
##   [7,]   11 0.0011655012 6.334245e-06
##   [8,]   14 0.0012468828 6.776537e-06
##   [9,]   15 0.0012315271 6.693082e-06
##  [10,]   16 0.0012886598 7.003586e-06
##  [11,]   17 0.0013531800 7.354239e-06
##  [12,]   18 0.0013698630 7.444908e-06
##  [13,]   19 0.0012903226 7.012623e-06
##  [14,]   20 0.0013037810 7.085766e-06
##  [15,]   21 0.0013262599 7.207934e-06
##  [16,]   22 0.0010706638 5.818825e-06
##  [17,]   23 0.0012285012 6.676637e-06
##  [18,]   24 0.0010706638 5.818825e-06
##  [19,]   25 0.0011235955 6.106497e-06
##  [20,]   27 0.0012987013 7.058159e-06
##  [21,]   28 0.0012437811 6.759680e-06
##  [22,]   29 0.0011273957 6.127151e-06
##  [23,]   30 0.0013717421 7.455120e-06
##  [24,]   31 0.0015082956 8.197259e-06
##  [25,]   32 0.0012562814 6.827616e-06
##  [26,]   33 0.0014492754 7.876497e-06
##  [27,]   34 0.0013947001 7.579892e-06
##  [28,]   35 0.0013908206 7.558808e-06
##  [29,]   36 0.0012484395 6.784997e-06
##  [30,]   37 0.0012180268 6.619711e-06
##  [31,]   38 0.0010050251 5.462093e-06
##  [32,]   39 0.0012195122 6.627784e-06
##  [33,]   40 0.0010395010 5.649462e-06
##  [34,]   41 0.0010729614 5.831312e-06
##  [35,]   42 0.0010373444 5.637741e-06
##  [36,]   43 0.0010989011 5.972289e-06
##  [37,]   44 0.0009970090 5.418527e-06
##  [38,]   45 0.0012269939 6.668445e-06
##  [39,]   46 0.0012019231 6.532191e-06
##  [40,]   47 0.0011098779 6.031945e-06
##  [41,]   48 0.0013003901 7.067338e-06
##  [42,]   49 0.0012804097 6.958749e-06
##  [43,]   50 0.0013157895 7.151030e-06
##  [44,]   51 0.0013245033 7.198388e-06
##  [45,]   52 0.0011098779 6.031945e-06
##  [46,]   53 0.0013386881 7.275479e-06
##  [47,]   54 0.0012674271 6.888191e-06
##  [48,]   55 0.0012919897 7.021683e-06
##  [49,]   56 0.0014970060 8.135902e-06
##  [50,]   57 0.0012515645 6.801981e-06
##  [51,]   58 0.0011494253 6.246877e-06
##  [52,]   59 0.0011876485 6.454611e-06
##  [53,]   60 0.0011976048 6.508722e-06
##  [54,]   61 0.0012135922 6.595610e-06
##  [55,]   62 0.0012062726 6.555829e-06
##  [56,]   63 0.0014534884 7.899393e-06
##  [57,]   64 0.0011709602 6.363914e-06
##  [58,]   65 0.0013262599 7.207934e-06
##  [59,]   66 0.0010718114 5.825062e-06
##  [60,]   67 0.0013280212 7.217507e-06
##  [61,]   68 0.0012285012 6.676637e-06
##  [62,]   69 0.0012610340 6.853446e-06
##  [63,]   70 0.0012019231 6.532191e-06
##  [64,]   71 0.0012771392 6.940974e-06
##  [65,]   72 0.0013642565 7.414437e-06
##  [66,]   73 0.0012642225 6.870774e-06
##  [67,]   74 0.0013812155 7.506606e-06
##  [68,]   75 0.0010235415 5.562725e-06
##  [69,]   76 0.0009363296 5.088748e-06
##  [70,]   77 0.0014044944 7.633122e-06
##  [71,]   78 0.0013458950 7.314647e-06
##  [72,]   79 0.0012970169 7.049005e-06
##  [73,]   80 0.0009389671 5.103082e-06
##  [74,]   82 0.0013568521 7.374196e-06
##  [75,]   83 0.0012484395 6.784997e-06
##  [76,]   84 0.0013568521 7.374196e-06
##  [77,]   85 0.0013986014 7.601095e-06
##  [78,]   86 0.0014556041 7.910892e-06
##  [79,]   87 0.0010845987 5.894558e-06
##  [80,]   88 0.0013175231 7.160451e-06
##  [81,]   89 0.0014471780 7.865098e-06
##  [82,]   90 0.0012658228 6.879472e-06
##  [83,]   91 0.0012658228 6.879472e-06
##  [84,]   92 0.0014450867 7.853732e-06
##  [85,]   93 0.0014044944 7.633122e-06
##  [86,]   94 0.0014970060 8.135902e-06
##  [87,]   95 0.0013698630 7.444908e-06
##  [88,]   96 0.0014880952 8.087474e-06
##  [89,]   97 0.0014124294 7.676247e-06
##  [90,]   98 0.0011933174 6.485421e-06
##  [91,]   99 0.0012626263 6.862099e-06
##  [92,]  100 0.0014409222 7.831099e-06
##  [93,]  101 0.0012870013 6.994572e-06
##  [94,]  102 0.0013966480 7.590479e-06
##  [95,]  103 0.0012820513 6.967670e-06
##  [96,]  104 0.0013003901 7.067338e-06
##  [97,]  105 0.0011723329 6.371375e-06
##  [98,]  106 0.0011990408 6.516526e-06
##  [99,]  107 0.0013661202 7.424566e-06
## [100,]  108 0.0013605442 7.394262e-06
## [101,]  109 0.0013422819 7.295010e-06
## [102,]  110 0.0013297872 7.227105e-06
## [103,]  111 0.0013262599 7.207934e-06
## [104,]  112 0.0011750881 6.386349e-06
## [105,]  113 0.0012658228 6.879472e-06
## [106,]  114 0.0013351135 7.256052e-06
## [107,]  115 0.0013123360 7.132261e-06
## [108,]  116 0.0014903130 8.099527e-06
## [109,]  117 0.0011723329 6.371375e-06
## [110,]  118 0.0011025358 5.992043e-06
## [111,]  120 0.0013210040 7.179369e-06
## [112,]  121 0.0013947001 7.579892e-06
## [113,]  122 0.0012531328 6.810505e-06
## [114,]  123 0.0012919897 7.021683e-06
## [115,]  124 0.0012547051 6.819050e-06
## [116,]  125 0.0012853470 6.985582e-06
## [117,]  126 0.0013368984 7.265752e-06
## [118,]  127 0.0013850416 7.527400e-06
## [119,]  128 0.0013605442 7.394262e-06
## [120,]  129 0.0012210012 6.635876e-06
## [121,]  130 0.0012722646 6.914482e-06
## [122,]  131 0.0012531328 6.810505e-06
## [123,]  132 0.0013227513 7.188866e-06
## [124,]  133 0.0012804097 6.958749e-06
## [125,]  134 0.0012547051 6.819050e-06
## [126,]  135 0.0012330456 6.701335e-06
## [127,]  136 0.0011481056 6.239704e-06
## [128,]  137 0.0011299435 6.140997e-06
## [129,]  138 0.0011668611 6.341637e-06
## [130,]  139 0.0011098779 6.031945e-06
## [131,]  140 0.0012919897 7.021683e-06
## [132,]  141 0.0012610340 6.853446e-06
## [133,]  142 0.0011834320 6.431695e-06
## [134,]  143 0.0011792453 6.408942e-06
## [135,]  145 0.0010460251 5.684919e-06
## [136,]  147 0.0011441648 6.218287e-06
## [137,]  148 0.0011792453 6.408942e-06
## [138,]  149 0.0013679891 7.434723e-06
## [139,]  150 0.0012970169 7.049005e-06
## [140,]  151 0.0011481056 6.239704e-06
## [141,]  152 0.0012285012 6.676637e-06
## [142,]  153 0.0012515645 6.801981e-06
## [143,]  154 0.0012515645 6.801981e-06
## [144,]  155 0.0010395010 5.649462e-06
## [145,]  156 0.0012642225 6.870774e-06
## [146,]  157 0.0011961722 6.500936e-06
## [147,]  158 0.0010493179 5.702815e-06
## [148,]  159 0.0011876485 6.454611e-06
## [149,]  160 0.0011834320 6.431695e-06
## [150,]  161 0.0009624639 5.230782e-06
## [151,]  162 0.0012210012 6.635876e-06
## [152,]  163 0.0012886598 7.003586e-06
## [153,]  164 0.0012106538 6.579640e-06
## [154,]  165 0.0014513788 7.887928e-06
## [155,]  166 0.0014347202 7.797393e-06
## [156,]  168 0.0012468828 6.776537e-06
## [157,]  169 0.0013386881 7.275479e-06
## [158,]  170 0.0010471204 5.690872e-06
## [159,]  171 0.0015174507 8.247015e-06
## [160,]  172 0.0012987013 7.058159e-06
## [161,]  173 0.0012903226 7.012623e-06
## [162,]  174 0.0012755102 6.932121e-06
## [163,]  175 0.0013123360 7.132261e-06
## [164,]  176 0.0013315579 7.236728e-06
## [165,]  177 0.0013888889 7.548309e-06
## [166,]  178 0.0012269939 6.668445e-06
## [167,]  179 0.0013513514 7.344301e-06
## [168,]  180 0.0012771392 6.940974e-06
## [169,]  181 0.0012300123 6.684849e-06
## [170,]  182 0.0011574074 6.290258e-06
## [171,]  183 0.0011961722 6.500936e-06
## [172,]  184 0.0012919897 7.021683e-06
## [173,]  186 0.0011904762 6.469979e-06
## [174,]  187 0.0011520737 6.261270e-06
## [175,]  188 0.0009328358 5.069760e-06
## [176,]  189 0.0010214505 5.551361e-06
## [177,]  190 0.0013175231 7.160451e-06
## [178,]  191 0.0011792453 6.408942e-06
## [179,]  193 0.0010893246 5.920242e-06
## [180,]  195 0.0011173184 6.072383e-06
## [181,]  196 0.0011494253 6.246877e-06
## [182,]  198 0.0012755102 6.932121e-06
## [183,]  199 0.0011507480 6.254065e-06
## [184,]  200 0.0009823183 5.338686e-06
## [185,]  201 0.0009541985 5.185861e-06
betweenness_w(matrix)
## Warning in as.tnet(net, type = "weighted one-mode tnet"): There were self-loops
## in the edgelist, these were removed
##        node betweenness
##   [1,]    1   103.16234
##   [2,]    2    13.70519
##   [3,]    3   206.48832
##   [4,]    4   134.30519
##   [5,]    5  1894.66981
##   [6,]    6   662.05268
##   [7,]    7   471.93250
##   [8,]    8  2175.61418
##   [9,]    9  6042.26018
##  [10,]   10  2891.88881
##  [11,]   11   941.92877
##  [12,]   12   955.00000
##  [13,]   13   113.58723
##  [14,]   14  4671.22576
##  [15,]   15   765.69304
##  [16,]   16  1039.96886
##  [17,]   17  1741.16064
##  [18,]   18  3726.33931
##  [19,]   19  5947.94785
##  [20,]   20  1148.04250
##  [21,]   21  3614.97702
##  [22,]   22  1054.33536
##  [23,]   23  2866.11759
##  [24,]   24  2194.22447
##  [25,]   25  2642.18841
##  [26,]   26   829.60974
##  [27,]   27   446.79214
##  [28,]   28  2440.92245
##  [29,]   29  4931.98041
##  [30,]   30  2981.83729
##  [31,]   31  8423.95999
##  [32,]   32  2385.92979
##  [33,]   33  2069.33265
##  [34,]   34  2540.66718
##  [35,]   35  1374.63935
##  [36,]   36  3645.41423
##  [37,]   37   873.26959
##  [38,]   38   859.77051
##  [39,]   39   530.59738
##  [40,]   40   281.65977
##  [41,]   41   123.05823
##  [42,]   42   296.93945
##  [43,]   43   168.53267
##  [44,]   44    50.93515
##  [45,]   45  2313.76004
##  [46,]   46   715.58447
##  [47,]   47   541.36953
##  [48,]   48  2324.71969
##  [49,]   49  2062.17387
##  [50,]   50  1129.09275
##  [51,]   51  1933.34165
##  [52,]   52   854.67161
##  [53,]   53   792.77265
##  [54,]   54  1269.25022
##  [55,]   55  1982.32771
##  [56,]   56  1262.78732
##  [57,]   57  2437.16369
##  [58,]   58    87.05996
##  [59,]   59   120.41825
##  [60,]   60  2385.65352
##  [61,]   61  1089.28466
##  [62,]   62    68.84379
##  [63,]   63   404.00692
##  [64,]   64  1530.24073
##  [65,]   65   700.64331
##  [66,]   66   585.61856
##  [67,]   67  1015.31306
##  [68,]   68   719.23748
##  [69,]   69   443.95217
##  [70,]   70   413.22821
##  [71,]   71  1514.74897
##  [72,]   72  1702.03163
##  [73,]   73  1023.85019
##  [74,]   74  3031.59243
##  [75,]   75  1286.43972
##  [76,]   76  1569.05502
##  [77,]   77   234.11176
##  [78,]   78   678.62480
##  [79,]   79  2427.45758
##  [80,]   80   629.61590
##  [81,]   81   592.72619
##  [82,]   82  1765.38258
##  [83,]   83  1640.30311
##  [84,]   84  2868.93717
##  [85,]   85  1932.62036
##  [86,]   86  4481.00585
##  [87,]   87   755.42327
##  [88,]   88  1146.18896
##  [89,]   89  3404.25011
##  [90,]   90   709.65210
##  [91,]   91   775.08223
##  [92,]   92  1082.51358
##  [93,]   93   842.36297
##  [94,]   94  4371.44208
##  [95,]   95  4700.56751
##  [96,]   96  1833.93095
##  [97,]   97   757.72528
##  [98,]   98  1362.03306
##  [99,]   99  2254.61647
## [100,]  100  5803.93580
## [101,]  101  3758.02700
## [102,]  102   197.68169
## [103,]  103   522.86304
## [104,]  104  1743.34702
## [105,]  105   550.10504
## [106,]  106  2253.98220
## [107,]  107  1249.02812
## [108,]  108   534.18875
## [109,]  109  1238.26706
## [110,]  110  1078.43262
## [111,]  111  2290.97772
## [112,]  112  1836.87535
## [113,]  113  1055.65324
## [114,]  114  2494.86576
## [115,]  115  3860.67737
## [116,]  116  2138.33467
## [117,]  117  2630.38574
## [118,]  118  1081.79517
## [119,]  119   676.18679
## [120,]  120  1699.17482
## [121,]  121   981.97328
## [122,]  122  1985.74695
## [123,]  123   940.45031
## [124,]  124   277.38511
## [125,]  125   547.13770
## [126,]  126  2855.65896
## [127,]  127  2135.18964
## [128,]  128  2155.07584
## [129,]  129  1324.69713
## [130,]  130  1881.30102
## [131,]  131  2062.00197
## [132,]  132   581.42966
## [133,]  133  2641.90787
## [134,]  134  1968.64885
## [135,]  135  1019.75065
## [136,]  136  1174.18884
## [137,]  137  1604.33067
## [138,]  138  1193.57587
## [139,]  139   670.35694
## [140,]  140  1486.38735
## [141,]  141   959.85361
## [142,]  142  1132.64931
## [143,]  143  1165.22541
## [144,]  144   950.00000
## [145,]  145  1251.29990
## [146,]  146   950.00000
## [147,]  147  2092.92913
## [148,]  148  2736.60068
## [149,]  149   297.28434
## [150,]  150   776.27582
## [151,]  151   820.03086
## [152,]  152   484.56567
## [153,]  153   627.68615
## [154,]  154   627.68615
## [155,]  155   915.26450
## [156,]  156   685.77908
## [157,]  157   578.92925
## [158,]  158   666.61144
## [159,]  159  1001.21112
## [160,]  160   393.54820
## [161,]  161  1115.68457
## [162,]  162  1130.98844
## [163,]  163   694.92728
## [164,]  164   816.55503
## [165,]  165  1891.12136
## [166,]  166  1114.10231
## [167,]  167   950.00000
## [168,]  168   645.59524
## [169,]  169   953.54156
## [170,]  170   992.66755
## [171,]  171   754.80808
## [172,]  172   850.76227
## [173,]  173  1177.91883
## [174,]  174  1937.05271
## [175,]  175   837.59998
## [176,]  176   513.54245
## [177,]  177   262.62798
## [178,]  178   377.73536
## [179,]  179  1747.91428
## [180,]  180  1925.76894
## [181,]  181   971.01327
## [182,]  182   648.37138
## [183,]  183   848.10275
## [184,]  184   812.33432
## [185,]  185   950.00000
## [186,]  186  1395.71529
## [187,]  187   675.69850
## [188,]  188   681.91893
## [189,]  189   696.72019
## [190,]  190   589.27418
## [191,]  191  1023.84735
## [192,]  192   950.00000
## [193,]  193   639.89709
## [194,]  194   794.91667
## [195,]  195   769.86170
## [196,]  196   295.67782
## [197,]  197   950.00000
## [198,]  198   465.77397
## [199,]  199   644.11583
## [200,]  200   292.82103
## [201,]  201    53.14369
## [202,]  202     0.00000
## [203,]  203     0.00000
## [204,]  204     0.00000
## [205,]  205     0.00000
## [206,]  206     0.00000
## [207,]  207     0.00000
## [208,]  208     0.00000
## [209,]  209     0.00000
## [210,]  210     0.00000
## [211,]  211     0.00000
## [212,]  212     0.00000
## [213,]  213     0.00000
## [214,]  214     0.00000
## [215,]  215     0.00000
## [216,]  216     0.00000
## [217,]  217     0.00000
## [218,]  218     0.00000
## [219,]  219     0.00000
## [220,]  220     0.00000
## [221,]  221     0.00000
## [222,]  222     0.00000
## [223,]  223     0.00000
## [224,]  224     0.00000
## [225,]  225     0.00000
## [226,]  226     0.00000
## [227,]  227     0.00000
## [228,]  228     0.00000
## [229,]  229     0.00000
## [230,]  230     0.00000
## [231,]  231     0.00000
## [232,]  232     0.00000
## [233,]  233     0.00000
## [234,]  234     0.00000
## [235,]  235     0.00000
## [236,]  236     0.00000
## [237,]  237     0.00000
## [238,]  238     0.00000
## [239,]  239     0.00000
## [240,]  240     0.00000
## [241,]  241     0.00000
## [242,]  242     0.00000
## [243,]  243     0.00000
## [244,]  244     0.00000
## [245,]  245     0.00000
## [246,]  246     0.00000
## [247,]  247     0.00000
## [248,]  248     0.00000
## [249,]  249     0.00000
## [250,]  250     0.00000
## [251,]  251     0.00000
## [252,]  252     0.00000
## [253,]  253     0.00000
## [254,]  254     0.00000
## [255,]  255     0.00000
## [256,]  256     0.00000
## [257,]  257     0.00000
## [258,]  258     0.00000
## [259,]  259     0.00000
## [260,]  260     0.00000
## [261,]  261     0.00000
## [262,]  262     0.00000
## [263,]  263     0.00000
## [264,]  264     0.00000
## [265,]  265     0.00000
## [266,]  266     0.00000
## [267,]  267     0.00000
## [268,]  268     0.00000
## [269,]  269     0.00000
## [270,]  270     0.00000
## [271,]  271     0.00000
## [272,]  272     0.00000
## [273,]  273     0.00000
## [274,]  274     0.00000
## [275,]  275     0.00000
## [276,]  276     0.00000
## [277,]  277     0.00000
## [278,]  278     0.00000
## [279,]  279     0.00000
## [280,]  280     0.00000
## [281,]  281     0.00000
## [282,]  282     0.00000
## [283,]  283     0.00000
## [284,]  284     0.00000
## [285,]  285     0.00000
## [286,]  286     0.00000
## [287,]  287     0.00000
## [288,]  288     0.00000
## [289,]  289     0.00000
## [290,]  290     0.00000
## [291,]  291     0.00000
## [292,]  292     0.00000
## [293,]  293     0.00000
## [294,]  294     0.00000
## [295,]  295     0.00000
## [296,]  296     0.00000
## [297,]  297     0.00000
## [298,]  298     0.00000
## [299,]  299     0.00000
## [300,]  300     0.00000
## [301,]  301     0.00000
## [302,]  302     0.00000
## [303,]  303     0.00000
## [304,]  304     0.00000
## [305,]  305     0.00000
## [306,]  306     0.00000
## [307,]  307     0.00000
## [308,]  308     0.00000
## [309,]  309     0.00000
## [310,]  310     0.00000
## [311,]  311     0.00000
## [312,]  312     0.00000
## [313,]  313     0.00000
## [314,]  314     0.00000
## [315,]  315     0.00000
## [316,]  316     0.00000
## [317,]  317     0.00000
## [318,]  318     0.00000
## [319,]  319     0.00000
## [320,]  320     0.00000
## [321,]  321     0.00000
## [322,]  322     0.00000
## [323,]  323     0.00000
## [324,]  324     0.00000
## [325,]  325     0.00000
## [326,]  326     0.00000
## [327,]  327     0.00000
## [328,]  328     0.00000
## [329,]  329     0.00000
## [330,]  330     0.00000
## [331,]  331     0.00000
## [332,]  332     0.00000
## [333,]  333     0.00000
## [334,]  334     0.00000
## [335,]  335     0.00000
## [336,]  336     0.00000
## [337,]  337     0.00000
## [338,]  338     0.00000
## [339,]  339     0.00000
## [340,]  340     0.00000
## [341,]  341     0.00000
## [342,]  342     0.00000
## [343,]  343     0.00000
## [344,]  344     0.00000
## [345,]  345     0.00000
## [346,]  346     0.00000
## [347,]  347     0.00000
## [348,]  348     0.00000
## [349,]  349     0.00000
## [350,]  350     0.00000
## [351,]  351     0.00000
## [352,]  352     0.00000
## [353,]  353     0.00000
## [354,]  354     0.00000
## [355,]  355     0.00000
## [356,]  356     0.00000
## [357,]  357     0.00000
## [358,]  358     0.00000
## [359,]  359     0.00000
## [360,]  360     0.00000
## [361,]  361     0.00000
## [362,]  362     0.00000
## [363,]  363     0.00000
## [364,]  364     0.00000
## [365,]  365     0.00000
## [366,]  366     0.00000
## [367,]  367     0.00000
## [368,]  368     0.00000
## [369,]  369     0.00000
## [370,]  370     0.00000
## [371,]  371     0.00000
## [372,]  372     0.00000
## [373,]  373     0.00000
## [374,]  374     0.00000
## [375,]  375     0.00000
## [376,]  376     0.00000
## [377,]  377     0.00000
## [378,]  378     0.00000
## [379,]  379     0.00000
## [380,]  380     0.00000
## [381,]  381     0.00000
## [382,]  382     0.00000
## [383,]  383     0.00000
## [384,]  384     0.00000
## [385,]  385     0.00000
## [386,]  386     0.00000
## [387,]  387     0.00000
## [388,]  388     0.00000
## [389,]  389     0.00000
#create smaller subset for visual purposes
sub2 <- sub%>%slice(1:60)

matrix2 = table(sub2)

matrix2 = as.matrix(matrix2)
#eigenvalue decomposition
adjMatr = as.matrix(as_adjacency_matrix(as.undirected(graph_from_data_frame(sub))))
plot(eigen(adjMatr)$values, type="b")
abline(h=1,col="red", lty = 3)

Explanation of Two Sets of Nodes

The two sets of nodes can be graphed as a network where each edge represents a directed flow of one item to another. The set contains 262111 nodes and 1234877 edges, therefore a smaller sample of the data was selected for clearer visuals. As seen below, each node represents each item within the network labeled by their product identification number. Each edge connected two nodes together represents a directed association betweeen the two items in a transaction.

library(lpbrim)
## 
## Attaching package: 'lpbrim'
## The following object is masked from 'package:tidyr':
## 
##     spread
#bBRIM(matrix2)
#algorithm prints large matrix to screen
plotweb(matrix2)

data.g = graph_from_incidence_matrix(matrix2)
#remove duplicage edges
cleaned <- simplify(data.g)
plot.igraph(cleaned)

Membership in The Network(Conclusion)

Identifying the membership of items within the dataset can be used to find the most relevant actors, in this case retail products, of the network (Yang, Keller, Zheng, 2016). By identifying the most influential item on Amazon’s inventory, marketing decisions can be made as to what kind of promotions can be used to attract attention to other items that may not be selling as frequent. In this network, eight communities were identified, each representing a group of items most frequently purchased together.
This positional approach can also provide insight on items by finding densely grouped communities within the network. By finding these clusters, Amazon can see what other bundled items occur the most within the website. Information like this can help companies formulate sales events, discounts, and decisions regarding inventory and ordering.

# Find group membership
# find densely connected subgraphs(communities)
wt <- cluster_walktrap(cleaned, steps = 6)
#get communities as object 
members <- membership(wt)
wt 
## IGRAPH clustering walktrap, groups: 8, mod: 0.7
## + groups:
##   $`1`
##    [1] "5"   "6"   "7"   "11"  "6"   "7"   "8"   "9"   "10"  "20"  "25"  "26" 
##   [13] "30"  "290"
##   
##   $`2`
##   [1] "0"  "1"  "0"  "1"  "2"  "3"  "4"  "5"  "15"
##   
##   $`3`
##   [1] "2"  "11" "12" "13" "14"
##   
##   + ... omitted several groups/vertices
modules <- findModules(matrix2, iter=2, sparse=FALSE)

plotModules(modules)

References

J. Leskovec, L. Adamic and B. Adamic. (2007).The Dynamics of Viral Marketing. ACM Transactions on the Web (ACM TWEB), 1(1), 2007. Retrieved from https://snap.stanford.edu/data/amazon0302.html

Sawardecker, E. N., Amundsen, C. A., Sales-Pardo, M., & Amaral, L. A. N. (2009). Comparison of methods for the detection of node group membership in bipartite networks. European Physical Journal B – Condensed Matter, 72(4), 671–677. https://doi-org.lopes.idm.oclc.org/10.1140/epjb/e2009-00397-6

Yang, S., Keller, F. B., & Zheng, L. (2016). Social network analysis: Methods and examples. Los Angeles, CA: Sage. ISBN: 9781483325217 URL: http://www.gcumedia.com/digital-resources/sage/2016/social-network-analysis_methods-and-examples_1e.php