Exact Computation of Influence Spread by Binary Decision Diagrams Takanori Maehara1,2) Hirofumi Suzuki3) Masakazu Ishihata3) 1)ShizuokaUniversity 2)RIKENCenterforAdvancedIntelligenceProject 3)HokkaidoUniversity [email protected] [email protected] [email protected] 7 ABSTRACT 1. INTRODUCTION 1 0 Evaluating influence spread in social networks is a funda- 2 mental procedure to estimate the word-of-mouth effect in 1.1 Background and Motivation n viral marketing. There are enormous studies about this Viralmarketing isastrategytopromoteproductsbygiv- a topic;however,underthestandardstochasticcascademod- ingfree(ordiscounted)itemstoaselectedgroupofhighlyin- J els,theexactcomputationofinfluencespreadisknowntobe fluentialindividuals(seeds),inthehopethatthroughword- 6 #P-hard. Thus,theexistingstudieshaveusedMonte-Carlo of-moutheffects,asignificantproductadoptionwilloccur[8, simulation-based approximations to avoid exact computa- 27]. To maximize the number of adoptions, Kempe, Klein- ] tion. berg, and Tardos [19] mathematically formalized the dy- S Weproposethefirstalgorithmtocomputeinfluencespread namics of information propagation, and proposed the op- D exactly under the independent cascade model. The algo- timization problem, referred to as the influence maximiza- . rithm first constructs binary decision diagrams (BDDs) for tion problem. Several cascade models have been proposed, s all possible realizations of influence spread, then computes andthemostcommonlyusedoneistheindependentcascade c [ influencespreadbydynamicprogrammingontheconstructed model, proposed by Goldberg, Libai, and Muller [10,11]. BDDs. To construct the BDDs efficiently, we designed a In this model, the individuals are affected by information 1 new frontier-based search-type procedure. The constructed that is stochastically and independently propagated along v BDDs can also be used to solve other influence-spread re- edges in the network from the seed (Section 2.1). To date, 0 latedproblems,suchasrandomsamplingwithoutrejection, significant efforts have been devoted to the development 4 conditionalinfluencespreadevaluation,dynamicprobability of efficient algorithms for the influence maximization prob- 5 update,andgradientcomputationforprobabilityoptimiza- lem [1,4–7,25,26,31]. 1 tion problems. Here we consider the computational complexity of the 0 Weconductedcomputationalexperimentstoevaluatethe influence maximization problem. Under the independent . 1 proposed algorithm. The algorithm successfully computed cascade model, the expected size of influence spread is a 0 influencespreadonreal-worldnetworkswithahundrededges non-negative submodular function [19]; thus, a (1 −1/e) 7 in areasonabletime,which isquiteimpossiblebythenaive approximatesolution can beobtained by usingagreedy al- 1 algorithm. We also conducted an experiment to evaluate gorithm [24]. However, the evaluation of influence spread : the accuracy of the Monte-Carlo simulation-based approxi- is #P-hard [4] because it contains the problem of count- v mationbycomparingexactinfluencespreadobtainedbythe ing s-t connected subgraphs [32]. Thus all existing studies i X proposed algorithm. avoided the exact computation and employed the Monte- r Carlo simulation-based approximation, which simulates the a CCSConcepts dynamicsofinformationpropagationsufficientlymanytimes (e.g., Ω(1/ǫ2)) to obtain an accurate (e.g., 1±ǫ) approxi- •Mathematics of computing → Paths and connec- mation of influencespread [25] (Section 6). tivity problems; Graph enumeration; Decision dia- Inthisstudy,wefirsttackletheproblemofcomputing in- grams; •Information systems→ Social advertising; fluence spread exactly under the independent cascade model. As the problem is #P-hard, we are interested in an algo- Keywords rithmthat runsonsmall real-world networks(i.e., havinga viral marketing; influence spread; enumeration algorithm; few hundred edges) in a reasonable time. The motivations binary decision diagram for this studiesare as follows. Permissiontomakedigitalorhardcopiesofallorpartofthisworkforpersonalor • Influencespreadoversmallnetworksispracticallyim- classroomuseisgrantedwithoutfeeprovidedthatcopiesarenotmadeordistributed portant. Because real social networks often consist of forprofitorcommercialadvantageandthatcopiesbearthisnoticeandthefullcita- many small communities, it is reasonable to consider tiononthefirstpage. Copyrightsforcomponentsofthisworkownedbyothersthan ACMmustbehonored.Abstractingwithcreditispermitted.Tocopyotherwise,orre- each communityseparately orconsideronly theinter- publish,topostonserversortoredistributetolists,requirespriorspecificpermission communitynetwork. and/[email protected]. WWW’17April3–7,2017,Perth,Australia • When we wish to rank vertices according to their in- (cid:13)c 2017ACM.ISBN123-4567-24-567/08/06...$15.00 fluence spread, we need to compute the values accu- DOI:10.475/123 4 rately. Monte-Carlosimulationcannotbeusedforthis purpose because it requires Ω(1/ǫ2) samples for 1±ǫ Let G = (V,E) be a directed graph with vertices V and approximation; thus ǫ < 10−5 is impossible. On the edges E. Each edge e ∈ E has activation probability p(e). other hand, an exact method can be used because its Each vertex is either active or inactive. Note that inactive complexity does not depend on thedesired accuracy. vertices may become active, but not vice versa. Here, an active vertexis considered“influenced.” • Exact influence spread helps to analyze the quality of Suppose that information is propagated from S ⊆ V, Monte-Carlo simulation. Although many experiments which is called seeds. Initially, all vertices are inactive. using Monte-Carlo simulation have been conducted, Then,propagationoverthenetworkisperformedasfollows. nonehavebeencomparedwiththeexactvaluebecause First, each seed u ∈ S is activated. When u first becomes thereis noalgorithm that can computethis value. active, it is given a single chance to activate each currently • Establishingapracticalalgorithmforthefundamental inactive neighbor v with probability p((u,v)). This process #P-hardproblemisinterestingandimportanttaskin is repeated until no further activations are possible. The computerscience. expected number of activated vertices after the end of the processiscalled influence spread, whichisdenotedasσ(S). 1.2 Contributions There is a useful interpretation of influence spread with In thisstudy,we providethefollowing contributions. thismodel. Weselecteachedgee∈E withprobabilityp(e). Then, we obtain edge set F. We then consider the induced • Weproposeanalgorithm tocomputeinfluencespread subgraph G[F] = (V,F), which is a network consisting of exactly under the independent cascade model. Note only the selected edges. Here, let σ(S;F) be the number that this is the first attempt to compute this value of vertices reachable from some u ∈ S on G[F]. Then, we exactly (Section 3). obtain thefollowing: • The proposed algorithm enumerates all spread pat- terns using binary decision diagrams (BDDs). Then, σ(S)=E[σ(S;F)]= σ(S;F)p(F) (1) itcomputesinfluencespreadbydynamicprogramming FX⊆E on the BDDs. Here, we havedesigned a new frontier- based search method, which constructs the BDD for where s-tconnectedsubgraphsefficiently(Section 3.2). This is themain technical contribution of thisstudy. p(F)= p(e) (1−p(e′)). (2) • We conducted computational experiments to evaluate eY∈F e′∈YE\F the proposed algorithm (Section 5). We obtained the exact influence on real-world and synthetic networks Weuse thisformula to computetheinfluencespread. with a hundred edges in reasonable times. We also compared the obtained exact influence with the one 2.2 Binary decisiondiagram obtained using theMonte-Carlo simulation. As discussed in Section 3, the exact evaluation of (1) in- volves enumerating S-t connecting subgraphs, which is the Inaddition,usingtheconstructedBDDs,wecanalsosolve graphhavingapathfromS tot. Tomaintainexponentially thefollowing influence-spreadrelated problems (Section 4). many such subgraphs, we use the binary decision diagram • Randomsamplingfromthesetofrealizationsthatsuc- (BDD), which is a data structure to represent a Boolean cessfully propagates information helps to understand functioncompactly basedonShannondecomposition. Note the route of influence spread. We can perform this thataBooleanfunctioncanbeusedtorepresentssetfamily without rejection byusing theBDD. as theindicator function. ABDDisadirectedacyclicgraphD=(N,A)withnode • The conditional expectation of the influence spread set N and arc set A.1 It has two terminals 0 and 1. Each under the influenced (and non-influenced) conditions non-terminalnodeα∈N isassociated withvariablee∈E, on some vertices can be used to measure the effect of and has twoarcs called 0-arc and 1-arc. The nodespointed conducted viral promotion from a small observations. by0-arcand1-arcarereferredtoas0-childand1-child(de- This valueis efficiently computedby theBDDs. noted by α and α ), respectively. A BDD represents a 0 1 • When the activation probability changes, we can effi- Boolean function as follows: A path from the root node to ciently updatetheinfluencespread. the1-terminalrepresentsa(possiblypartial)variableassign- mentforwhichtherepresentedBooleanfunctionisTrue. As • Thederivativesoftheinfluencespreadwithrespectto thepathdescendstoa0-arc(1-arc)fromanode,thenode’s the activation probabilities can be computed. This is variable is assigned to False (True). usedtoimplementagradientmethodfortheinfluence A special type of BDD, i.e., reduced ordered binary deci- spread optimization problem. sion diagram (ROBDD) [3], is frequently used in practice. A BDD is ordered if different variables appear in the same 2. PRELIMINARIES order on all paths from the root. A BDD is reduced if the 2.1 Independent CascadeModelforInfluence Spread 1To avoid confusion, we use the terms“vertex”and ”edge” to refer to a vertex and edge in the original graph G, and The independentcascade model [10,11] is the most com- “node”and“arc”to refer to a vertex and edge in the BDD monlyusedstochasticcascademodelusedforsocialnetwork D. Vertices are denoted using Roman letters (u,v,...) and analysis. Thedynamicsof thismodel is given as follows. nodes are denotedusing Greek letters (α,β,...). Algorithm 1 Influencespread computation Figure 1: BDD for {{c},{a,b},{a,c},{b,c},{a,b,c}}. 1: Create BDD D=(N,A) for R(S,t) the 0-arc is denoted by the dotted line and the 1- 2: Set B(0)=0, B(1)=1 arcs are denoted by the solid lines. The arcs to 0- 3: for α∈N \{0,1} in thereverse topological orderdo terminal are omitted. 4: B(α)=(1−p(e(α)))B(α )+p(e(α))B(α ) a 0 1 5: endfor 6: return B(root) b c Figure 2: A graph for example. The BDD for R({s},t) is shown in Figure 1. 1 a b following two rules are applied as long as possible: 1. Shareany isomorphic subgraphs. s t c 2. Eliminate all nodes whose two arcs point to (3) thesame node. follows. Each node α ∈ N stores value B(α), which is the sum of the probabilities of all subsets represented by the These rules eliminate redundant nodes in the BDD. More- descendantsofα,calledthebackward probability. Theback- over, when ordering is specified, theROBDDis determined ward probabilities of 0-terminal and 1-terminal are initial- uniquely [3]. In terms of Boolean functions, the function ized to B(0) = 0 and B(1) = 1. We process the nodes in represented by the subgraph rooted by α corresponds to a reverse topological order (i.e., the terminals to the root). Shannonco-factor. Theabovetworulescorrespondtoshar- For each non-terminal node α∈N \{0,1} associated with ing nodes with the same Shannon co-factor. In this paper, edge e(α)∈E, B(α) is computed as follows: we use theterm BDD torefer toROBDD. Figure 1 shows an example of BDD, whihch represents B(α)=(1−p(e(α)))B(α )+p(e(α))B(α ). (7) 0 1 set family {{c},{a,b},{a,c},{b,c},{a,b,c}}. The indicator function is φ(a,b,c)=a(b+¯bc)+a¯c, which corresponds to Thisgivesadynamicprogrammingalgorithm(Algorithm1). thediagram. The backward probability of theroot nodeis σ(S,t). One important feature of BDD is that it allows efficient Here, we provide an example to illustrate the procedure. manipulation of set families. In particular, when two set ConsiderthegraphshowninFigure2,whichhasthreeedges families arerepresentedbyBDDsD andD withthesame (a,b,andc). Theseactivationprobabilitiesarep. Then,the 1 2 variableordering,theunionandintersectionoftheseBDDs {s}-t connectingsubgraphsare as follows: are performed in O(|D ||D |) time. The complement of a 1 2 R({s},t)={{c},{a,b},{a,c},{b,c},{a,b,c}}. (8) set family represented by BDD D is performed in O(|D|) time [3,29]. This property is utilized in this study. The BDD for this set family is presented in Figure 1. We FordetailsaboutBDDs,seethelatestvolumeof“TheArt perform dynamicprogramming on this BDD as follows: of ComputerProgramming”[21] byKnuth. B(1)=1, B(c)=p, B(b)=p+(1−p)p, 3. ALGORITHM B(a)=p2+(1−p)p2+(1−p)p=p+p2−p3X. Inthissection,weproposeanalgorithmtocomputeinflu- ence spread exactly. Let S ⊆V be a seed set and t∈V be Thereforetheinfluenceprobabilityfrom{s}totisp+p2−p3. a vertex. Weconsider theset of S-t connectingsubgraphs 3.2 BDD Construction R(S,t)={F ⊆E :t is reachable from S on G[F]}, (4) Here,wepresentanalgorithmtoconstructtheBDDD(S,t) whichrepresentsallrealizationsinwhichtisactivatedfrom for R(S,t). This is the main technical contribution of this seed set S. Using thisset, influencespread is expressed as study. Wefirstconsiderthesingleseedcase(i.e.,S ={s})inSec- σ(S)= σ(S,t), (5) tion3.2.1. Then,weconsiderageneralcaseinSection3.2.2. tX∈V Forsimplicity,wewriteR(s,t)andD(s,t)forR({s},t)and where σ(S,t) is theinfluenceprobability from S to t,i.e., D({s},t), respectively. σ(S,t)=p(R(S,t))= p(F). (6) 3.2.1 BDDforasingleseed F∈XR(S,t) Our algorithm is a type of frontier-based search, which Ouralgorithmcomputesinfluencespreadbasedontheabove is a general procedure for enumerating all constrained sub- formulas. ThealgorithmfirstconstructstheBDDforR(S,t). graphs [18].2 In the following, we first describe the general Then it computes σ(S,t) by dynamic programming on the framework of the frontier-based search. Then, to adapt it BDD. Finally, by summing over t∈V, we obtain the influ- toourproblem,wedescribefourmaincomponents: configu- ence spread σ(S). ration, isZeroTerminal function, isOneTerminal function, 3.1 Influence Spread Computation 2Frontier-based search is often applied to construct a zero- suppressedBDD,whichisaspecialkindofBDD.However,in Once BDD D(S,t) for R(S,t) is obtained, σ(S,t) is ef- ourproblem,theset hasmany“don’tcare”edges; therefore ficiently obtained by bottom-up dynamic programming as BDD is more suitable than ZDD. and createNode function. Finally we describe two tech- Algorithm 2 Frontier-based search niques to improve performance: edge ordering and prepro- 1: N0←{root}, Ni←∅ for i=1,2,...,|E| cessing. 2: for i=1,2,...,|E| do 3: for α∈Ni−1 do Frontier-basedsearch. 4: for x∈{0,1} do Let us enumerate all constrained subgraphs R⊆2E. We 5: if isZeroTerminal(α,ei,x) then fix an ordering of edges (e1,...,em) and process the edges 6: αx ←0 one by one, as the exhaustive search. The processed edges 7: elseif isOneTerminal(α,ei,x)then and the unprocessed edges at the end of i-th step are de- 8: αx ←1 notedbyE≤i:={e1,...,ei}andE>i :={ei+1,...,em},re- 9: else spectively. The set of vertices that has both processed and 10: β ←createNode(α,ei,x) unprocessed edges is called the frontier (at the i-th step) 11: if φ(β)=φ(β′) for some β′ ∈Ni then and denoted by Wi. 12: β ←β′ The set of nodes Ni represents all subsets of E≤i that 13: else canpossiblybelongstoR. Eachα∈Ni representspossibly 14: Ni ←Ni∪{β} many subsets R(α) ⊆ 2E≤i by paths from the root to α, 15: end if whereapathfromtheroottoαrepresentsasubsetinwhich 16: αx ←β eispresentintheset ifthepathdescendsthe1-arcofnode 17: endif β associated with e. We say that two edge sets F and F′ 18: endfor are equivalent if for any subsets H ⊆E>i, both F ∪H and 19: endfor F′∪H belong to R or neitherbelong to R. The algorithm 20: end for maintains that all sets in R(α) are equivalent. 21: ReducetheconstructedBDDbythereductionrules(3) At the i-th iteration, the algorithm constructs Ni from Ni−1. Foreachnodeα∈Ni−1,thealgorithmgeneratestwo and H ⊆ E>i. Thus the configuration must satisfy that children for which ei is excluded or included in the sets in φ(β)=φ(β′) implies theabovecondition. R(α). Here, the important feature is node merging. Let β Here, we propose to use the reachability information on and β′ benodes generated at the i-th step. If all F ∈R(β) the frontier vertices as the configuration as follows. Let andF′∈R(β′)areequivalent,wecanmergethemtoreduce Wis+,Wi+t ⊆ Wi be the set of frontier vertices that are the number of nodes. To verify this equivalence efficiently, reachable from s and reachable to t, respectively, on G[F] each node β maintains a data φ(β), referred to as configu- whereF ∈R(β). Notethatthesearewell-defined,i.e., they ration, which satisfies the condition that: if φ(β) = φ(β′) areindependentofthechoiceofF,asmentionedbelow. Let then the all corresponding sets are equivalent. Note that Wis− =Wi\Wis+,Wi−t=Wi\Wi+t. Wedefinetheconfigu- the inverse is not required, which causes redundant node rationφ(β)asamatrixindexedby(Wis−∪{s})×(Wi−t∪{t}) expansions. whose entries denotereachability on G[F]: Aftertheprocess,theconstructedBDDisnotnecessarily reduced. Thus,werepeatedlyapplythereductionrules(3). 1 v is reachable from uon G[F], Thisreductionisperformedintimeproportionaltothesize φ(β)uv = (11) (0 otherwise. of theBDD [3]. Thegeneralframeworkofthefrontier-basedsearchisshown in Algorithm 2, which contains three auxiliary functions. If F ∪H admits (does not admit) an s-t path, any F′ ∈ isZeroTerminal(α,ei,x)(isOneTerminal(α,ei,x))determines R(β′) with φ(β) = φ(β′) also admits (does not admit) an whether thenode for thesets excluding(including) ei from s-t path because we can transform the s-t path on G[F] R(α) is the 0-terminal (1-terminal). More precisely, these to that on G[F′] by reconnecting the path on the frontier. are defined as follows: This shows that φ satisfies the configuration requirement described above. This also proves, by induction, that this isZeroTerminal(α,ei,x) definition is well-defined, i.e., φ(β) is independent of the choice of F. True all x-descendantsare excludedfrom R, = (9) (False otherwise, “isZeroTerminal”and”isOneTerminal”functions. isOneTerminal(α,ei,x) R(Iαf)x,w=eh1,avie.ea.,cwheanicnecltuodoebetdaigneiesiO=neT(eur,mvi)nianl(tαhe,esie,txs)i=n True all x-descendantsare includedto R, True, which is the case that the included edges contain a = (10) (False otherwise. path from s to t. Using our configuration, this is easily implemented as follows: createNode(α,ei,x) creates an x-child of α. To adapt the generalframeworktoours-tconnectingsubgraphenumera- isOneTerminal(α,ei,1) tion problem, we only have to design the configuration and these functions. = True φ(α)su =1 and φ(α)vt=1, (12) (False otherwise. Configuration. Fortwonodesβ,β′ ∈Ni,wewanttomergethesenodesif Similarly, if x= 0, i.e., we exclude edge ei from the sets in these are equivalent,i.e., the s-t reachabilities on G[F ∪H] R(α),wehaveachancetoobtainisZeroTerminal(α,ei,x)= and G[F′∪H] are the same for all F ∈ R(β), F′ ∈ R(β′), True,whichisthecasethattheexcludededgesformacutset from s to t. This is implemented as follows. The frontier-based search described in the previous sub- section can be easily adopted to the multiple seeds case. isZeroTerminal(α,ei,0) However,thereisamoreefficientwaytoconstructtheBDD True t is unreachablefrom s on G[F ∪E>i], for multiple seeds. = (13) The method is based on the following formula, which is (False otherwise immediately obtained from thedefinitionof R(S,t): where F ∈ R(α). Note that this is well-defined for the R(S,t)= R(s,t). (14) same reason described above. To check the reachability on G[F∪E>i]efficiently,weprecomputethetransitiveclosures s[∈S of G[E>j] for all j = 0,1,...,|E|.3 Then the reachability BecausetheBDDoftheunionoftwosetfamiliesrepresented from s to t is checked in O(|Wi|2) time by the DFS/BFS by BDDs D1 and D2 is obtained in O(|D1||D2|) time, and, with theconfiguration and theprecomputedreachability. practically, the size of the BDDs is small (Section 5), this approach is more efficient than thefrontier-based practice. “createNode”function. The most important role of createNode(α,ei,x) is com- 3.2.3 NodesharingamongBDDs putingtheconfigurationofthenewnode. Thefunctionfirst To compute influence spread, we construct BDDs for all createsnewnodeβandcopiesconfigurationφ(α)toφ(β). If pairsofs,t∈V. Here,intuitively,iftwosource-targetpairs a vertex is included in the frontier (i.e., some incident edge (s,t) and (s′,t′) are close, the BDDs D(s,t) and D(s′,t′) is processed first) or excluded from the frontier (i.e., all in- may share many subgraphs. Thus, by sharing the nodes cident edges have been processed), we insert or remove the correspondingtothesubgraphs,wecanreducethetotalsize correspondingrowandcolumnfromtheconfigurationφ(β). of theBDDs[23]. This also reducesthetotal complexity of Ifx=0,werequirenofurtherupdates. Otherwise,adding computinginfluencespreadsforallsource-targetpairs(s,t), anewedgechangesreachability;thusweupdateφ(β)tobe whichisproportionaltothetotalsizeofthesharedBDDs. the transitive closure of the frontier. This is performed in O(|Wi|2) time by theDFS/BFS on thefrontier. 4. OTHER APPLICATIONS Edgeordering. In the previous section, we established an algorithm to constructtheBDDforallS-tconnectingsubgraphsR(S,t). The complexity of the frontier-based search depends on thefrontiersize. Ni hasatmost O(2|Wi|2)nodesbecauseit pTrhoibsldematsaestffirucicetnutrley.allowsustosolveinfluencespread-related containsnonodeswiththesameconfigurations. Itisknown thatthefrontiersizeiscloselyrelatedtothepathwidth graph 4.1 Random Sampling withoutRejection parameter [20]. Sometimes we want to know how the influence is propa- Notethatoptimizingedgeorderingisimportanttoreduce gated from S to t. The random sampling from R(S,t) will thefrontiersize(i.e.,thepathwidth). Forourproblem,there help ustounderstandthis;however, thenaivemethodthat is an additional requirement,i.e., thesame edgeordering is performs Monte-Carlo simulation and rejects if S does not used for all BDDs R(s,t) for s,t ∈ V because we perform connecttotusuallyrequiresimpracticallymanysimulations several set manipulations between the BDDs. due to the small influence probability. Here we show that In this study,we use the path-decomposition based order- this random sampling can be performed without rejection ing proposedbyInoueandMinato[15]. Thealgorithm first using BDD D(S,t)=(N,A) [17]. computesa pathdecomposition with a small pathwidthus- As a preprocess, we perform the dynamic programming ingbeamsearch-basedheuristics. Thenitcomputesanedge described in Section 3.1 to compute the backward proba- ordering using thepath decomposition information. bility B(α) for each node α ∈ N. Then, we perform the followingrandomwalk,whichstartsfromtherootnodeand Preprocessing. ends at the1-terminal: When we are on non-terminal node If e ∈ E is not contained in any s-t simple path, e does α∈N\{0,1}associated withe∈E,werandomlymoveα 0 not appear in the BDD because the existence of e does not or α with probability proportional to (1−p(e))B(α ) and 1 0 affects-treachability. Therefore,removingallsuchedgesas p(e)B(α ). Here, if we moved to α , we exclude e from F; 1 0 apreprocessing improvestheperformance ofthealgorithm. otherwiseweincludeeinF. Werepeatthisprocedureuntil Determiningwhetherthereis an s-t simple pathcontain- wereachthe1-terminal. Finally,forallundeterminededges, ing e is NP-hard because it reduces to the NP-hard two- werandomlyandindependentlyexcludeorincludetheedge commodity flow problem [9]. However, because we are in- withitsprobability. ThisyieldsarandomsamplingfromR. terested in small networks, we can enumerate all s-t sim- The complexity is proportional to theheight of the BDD. ple paths using Knuth’s Simpath algorithm [21], which is a frontier-based search algorithm that runs faster than the 4.2 Conditional Influence Spread proposed algorithm because it uses a smaller configuration. Afterconductingaviralpromotion,wemustmeasurethe Thus, we can usetheSimpath algorithm in preprocessing. effect of the promotion. For this purpose, we observe the 3.2.2 BDDformultipleseeds status of influence (i.e., influenced or not) on some small verticesandestimatethetotalsizeofinfluencespread. This 3Because we compute the BDDs for all pairs of s,t ∈ V, value,referredtoastheconditional influencespread,canbe obtained using theconstructed BDDs. storing all transitive closures accelerates computation. The sizeofalltransitiveclosuresaretypicallymuchsmallerthan For example, suppose that we have observed that “ver- thesize of theBDDs. ticesu,v areinfluencedandw isnotinfluenced.”Then,the realizations that satisfy this condition is given by BecauseMonte-Carlosimulationcannotbeusedtocompute thederivative,thisisanadvantageofourmethod. Notethat R=R(S,u)∩R(S,v)∩R(S,w)c, (15) thistechniqueisused in probabilistic logic learning [14,16]. whereR(S,w)c =2E\R(S,w). Thentheconditionalinflu- 5. EXPERIMENTS ence probability from S to t underR is given by Weconductedcomputationalexperimentstoevaluatethe p(R(S,t)∩R) σ(S,t|R)= , (16) proposed algorithm. All code was implemented in C++ p(R) (g++5.4.0 with the -O3 option) using the TdZdd library4, which is a highly optimized implementation for BDDs. All and the summation over t gives the conditional influence experiments were conducted on 64-bit Ubuntu 16.04 LTS spread. withanIntelCorei7-3930K3.2GHzCPUand64GBRAM. TheBDDsforR(S,t)∩RandRin(16)canbeefficiently Thereal-worldnetworksweretakenfromtheKoblenzNet- obtainedbecauseBooleanoperationsonsetfamiliesareper- work Collection.5 All self-loops and multiple edges were formed efficientlyon BDDrepresentations. Moreover, these removed, and undirected edges were replaced with two di- probabilitiescanbecomputedbythethedynamicprogram- rectededgesinbothdirections. Thenumberofverticesand ming described in Section 3.1. This is the method for com- edges are described in Table 1 putingtheexact conditional influencespread. Note that, by combining random sampling technique de- 5.1 Scalability onReal-WorldNetworks scribedinSection4.1,wecansampleconditionalrealizations without rejection. First, to evaluate the performance of the proposed algo- rithminthereal-worldnetworks,weconductedexperiments 4.3 ActivationProbability Modification onthecollectednetworks. Foreachnetwork,weconstructed theBDDsforalldistincts,t∈V andobservedthecomputa- Activation probabilities are frequently changed in real- tionaltime,thesizeofeachBDD,thetotalsharedsizeofthe world networks [26]. In such a case, we can recompute the BDDs, and the number of realizations that are represented influence spread easily by reusing the constructed BDDs. by theBDDs(i.e., cardinality of theset). The complexity is proportional to thesize of theBDDs. The results are shown in Table 1. The algorithm suc- 4.4 ActivationProbability Optimization cessfully computed the BDDs for networks with a hundred edges, but failed on some larger networks. When it suc- Sometimeswewanttosolveanoptimizationproblemwith ceeded,itisveryefficientinbothtimeandspace,i.e.,itran respect to the activation probabilities of edges. One exam- inafewmillisecondsandthesizewasatmostafewmillions ple is a time-dependent influence problem, i.e., when the for a network with a few hundred edges. The shared size activation probabilities are the function on time, we want was about the half of the sum of all sizes of BDDs, which to seek the time that maximizes influence spread. Another means that the BDDs shared many nodes. By comparing exampleisanetworkdesignproblemwherewewanttomax- Contiguous-USAnetworkandthethreefailednetworks,the imizetheinfluencespreadbymodifyingactivationprobabil- computational cost dependedon thenetwork structure. ities under some (e.g., budget) constraint. Because these Itshould beemphasized thatthenaiveexhaustivesearch problemsarenon-convexoptimizationproblems(evenifthe isquiteimpracticalforthesenetworksbecause,asshown in activation probabilities are simple functions), it is difficult Cardinalitycolumn,thereareenormousnumberofconnect- to compute the optimal solution. However, a local optimal ing realizations. In particular, at the extreme case, a BDD solution would beobtained bya gradient-based method. D(s,t) for American-Revolutionnetwork with some source- Toimplementagradient-basedmethod,werequirederiva- targetpair(s,t)consistedofonly85nodes,butrepresented tives of the influence spread with respect to the activation probabilities. Here we show that if we have the BDD for 2,058,334,714,926,419,025,286,040,286,320, R(S,t), we can obtain ∂σ(S,t)/∂p(e) for all e ∈ E in time 632,494,993,236,943,086,975,345,403,704,463, (19) proportional tothesize of theBDD. 133,047,043,046,026,363,318,022,843,662,336 First, we compute the backward probability B(α) for all nodes α ∈ N by the dynamic programming described in realizations (approximately 2 × 1097), which exceeds the Section3.1. Then,weperform top-downdynamicprogram- numberofatomsintheuniverse(approximately1080). This ming as follows. Each node α ∈ N has a value F, called showstheeffectivenessoftheBDDrepresentationofthecon- theforward probability. Theforward probability oftheroot nectingrealizations. node is initialized as F(root)=1. We process the nodes in topological order(i.e., theroot totheterminals). Whenwe 5.2 Scalability onSynthetic Networks areonnon-rootnodeα∈N\{root},itsforwardprobability Next, to observe the performance of the algorithm pre- is determined as follows: cisely, we conducted experiment on two classes of synthetic networks. The first class was 5×w grid graph, which has F(α)= (1−p(e(β)))F(β)+ p(e(γ))F(γ). n = 5w vertices and 9w −5 undirected edges, which has β:Xβ0=α γ:Xγ1=α a pathwidth of 5. The second class was the random graph (17) that has the same numberof vertices and edges as thegrid graph,which has apathwidthof Θ(n). Wecomputedinflu- Then, thederivativeis obtained as follows: ence probability σ(s,t) from the north-west corner s to the ∂σ(S,t) ∂p(e) = F(α)B(α1). (18) 4https://github.com/kunisura/TdZdd α:eX(α)=e 5http://konect.uni-koblenz.de/ Table 1: Computational results on real-world networks. Time denotes the average time to construct the BDDs, BDD Size denotes the average number of nodes in the BDDs, Shared Size denotes the total number of distinct nodes in the shared BDDs, and Cardinality denotes the average number of subgraphs represented by the BDDs. Here, average is taken of all distinct s,t∈V. For the last three networks, the algorithm failed to compute due to the memory limit. Network Vertices Edges Time [ms] BDD Size Shared Size Cardinality South-African-Companies 11 26 0.1 12.1 472 2.2e+07 Southern-women-2 20 28 0.3 54.7 2,266 1.3e+08 Taro-exchange 22 78 4.1 1,119.2 277,756 1.6e+23 Zachary-karate-club 34 156 24.9 7,321.8 4,988,148 6.4e+46 Contiguous-USA 49 214 117.9 30,599.8 41,261,047 1.6e+64 American-Revolution 141 320 2.2 120.0 1,530,677 5.7e+95 Southern-women-1 50 178 — — — — Club-membership 65 190 — — — — Corporate-Leadership 64 198 — — — — south-eastcornertonthegridgraphandthecorresponding ·10−3 vertices on therandom graph. ce n The results are shown in Figure 3. For the grid graphs, ue 1·100 BDD size and construction time increased slowly; thus the fl n computation on n=100 was tractable. On theotherhand, i d for the random graphs, BDD size and construction time e increased rapidly; thus we could not compute a BDD for mat 0·100 n≥45. Theseresultsareconsistent with thepathwidthsof ti s these networks. e e Forbothnetworks,theinfluenceprobabilitiesdecayedex- th −1·100 ponentially. Itdecayedfasteringridnetworksincebasically of theinfluenceprobability dependson thenetwork distance. r o r r E −2·100 5.3 Influence MaximizationProblem 0 0.2 0.4 0.6 0.8 1 Here, we consider the influence maximization problem, Numberof samples ·107 which seeks k seeds to maximize the influence spread [19]. The greedy algorithm is commonly used to solve this prob- Figure 5: Accuracy of Monte-Carlo simulation. lem,whichbeginsfrom theemptysetS =∅andrepeatedly 6. RELATED WORK addsthevertexuthathasthemaximummarginalinfluence σ(S∪{u})−σ(S) into S untilk vertices are added. We implemented the greedy algorithm with the exact in- Influencespreadcomputation. fluence spread to observe the performance of the proposed After the seminal work by Kempe, Kleinberg, and Tar- algorithminthegreedyalgorithm. WeusedtheContiguous dos [19], influencespread over networks has become an im- USA network and Zachary Karate club networks. portant topic in social network analysis. However, to the TheresultsareshowninFigure4. Figure4(b)showsthat best of our knowledge, no efforts have been devoted to the thesharedsizeofBDDdidnotincreasewhilethealgorithm exact computation of influence spread since it is proved to process. The shared size at the 10-th step of the greedy be#P-hard by Chen et al. [4]. algorithm was two times larger than the 1-st step for both To compute influence spread, all existing studies used networks,andthecomputationaltimeswereproportionalto Monte-Carlosimulation-basedapproximation,whichrepeats thenumberof steps, as shown in Figure 4(c). simulation until a reliable estimation is obtained. This ap- proach is originally proposed in [19]. To enhance the scal- ability, many techniques, such as pruning [22] and sample 5.4 ComparisonwithMonte-Carlosimulation average approximation [4,6,25] havebeen investigated. Finally, for an application of exact influence spread com- TherecentapproximationmethodsarebasedontheBorgs putation, we compared the exact influence spread with the etal.’sreverseinfluencesampling (RIS)technique[1],which Monte-Carlosimulation. WeusedtheContiguousUSAnet- randomlyselectsavertexandthenperformsreverseBFSto work, which was also used in the above experiment. In ad- compute the set of vertices reachable to the selected vertex dition,weusedaseedsetofsize10computedbythegreedy on a random graph. It is important that this procedure is algorithmwiththeexactinfluencespread,andwecompared implementedintimeproportionaltothesizeof thesample. thequality of theapproximated spread. Thereforeitsuccessfully boundsthecomplexityofinfluence TheresultsareshowninFigure5. Evenforsuchsmallsize spreadapproximation. Tang,Shi,andXiao[30,31]proposed network (m = 107 edges) and the large number of Monte- themethods toreducethenumberof samples. Carlo samples (N = 107), the estimated influence spread Notethatourformulation(5)isrelatedwiththeRIStech- by Monte-Carlo simulation has error in the order of 10−3, nique: RIS randomly selects vertices whereas we select all which is consistent with thetheory [25]. (a) InfluenceProbability (b) BDD Size (c) Time [s] 100 y 102 t bili a e eprob 10−10 DDSiz 105 Time 10−1 c n B e u Grid Grid Grid fl n Random Random Random I 10−20 100 10−4 0 50 100 0 50 100 0 50 100 Numberof verticesn Numberof vertices n Numberof vertices n Figure 3: Computational results on 5×w grid graphs and random graphs. The algorithm failed to compute the influence spread on the random network with n≥45 vertices due to the memory limit. (a) Influencespread (b) SharedSize (c) Time [s] 108 15 102 d a e e spr 10 Siz 107 [s] 101 e d e c e m en ar Ti flu 5 Sh 106 100 n ContUSA ContUSA ContUSA I Zachary Zachary Zachary 0 105 10−1 5 10 5 10 5 10 Numberof steps Numberof steps Numberof steps Figure 4: Computational results on the influence maximization problem with exact influence spread. vertices, and RIS samples single reverse influence patterns Thenitcomputesinfluencespreadbydynamicprogramming whereas ours enumeratesall reverseinfluencepatterns. on the constructed BDDs. The BDDs can also be used to solve some other influence-spread related problems effi- Subgraphenumeration. ciently. Theresultsof ourcomputational experimentsshow Inthisstudy,wevirtuallysolvedtheenumerationproblem that the proposed algorithm scales up to networks with a ofs-tconnectingsubgraphsfortheinfluencespreadcompu- hundrededges,eventhoughtheyhaveanenormousnumber tation. This problem is known tobe #P-hard[32]. (i.e., ∼2×1097) of possible realizations. If the underlying network is undirected, this problem co- Asimilarapproachwillbeadoptedforthelinearthreshold incideswiththetwo-terminal network reliabilityproblem [2, model [19], which is anotherwidely used stochastic cascade 32],andseveralalgorithmshavebeenproposedtoconstruct model: Goyal, Lu, and Lakshmanan [12] showed that the a BDD for the problem [13,33]. However, none have been influence spread in this model is computed by enumerat- naturally generalized to our directed problem because they ing all s-t paths, and they proposed an algorithm, named essentially exploit theundirected natureof thegraph. “Simpath,”basedonanexhaustivesearchwithpruning. By BDDisusedtoenumerateseveralkindsofsubgraphs(sub- constructing the BDDs for all s-t paths, rather than for all structures), such as paths [21], spanning trees [28], and the s-tconnectedsubgraphsasinthisstudy,similarresultswill solutionsoflogicpuzzles[34]. Bycomparingthesemethods, beobtained. Notethatthereisanefficientalgorithmtocon- the proposed method involves relatively expensive opera- struct the BDD for all s-t paths [21], which is also named tions (reachability computation) in the auxiliary functions “Simpath.”Thisalgorithmisusedinthisstudytoprunethe used in the frontier-based search. Such operations usually redundantedges in preprocessing. makethealgorithmnon-scalable; thusthesearenotusedin The most important future work is computing exact (or literature. However,inourcase,thesearenecessarytoscale highly accurate) influence spread in networks with a few up thealgorithm bypruningmany nodesin each step. hundred edges or a thousand edges. This may require new technique such as parallel construction of BDDs, approxi- mation of BDDs, or exploiting network structures. 7. CONCLUSION Acknowledgment Inthisstudy,wehaveproposedan algorithm tocompute influence spread exactly. The proposed algorithm first con- This work was supported byJSPS KAKENHIGrant Num- structstheBDDstorepresentall s-tconnectingsubgraphs. bers 15H05711 and 16K16011, and by JST, ERATO, Kawarabayashi Large Graph Project. [17] M. Ishihataand T. Sato. Bayesian inference for statistical abduction usingmarkov chain montecarlo. InACML, pages 81–96, 2011. 8. REFERENCES [18] J. Kawahara, T. Inoue,H. Iwashita, and S. Minato. [1] C. Borgs, M. Brautbar,J. Chayes, and B. Lucier. Frontier-based search for enumeratingall constrained Maximizing social influencein nearly optimal time. In subgraphswith compressed representation. SODA, pages 946–957, 2014. TCS-TR-A-13-64. Hokkaido University, 2014. [2] T. B. Brecht and C. J. Colbourn. Lower boundson [19] D.Kempe, J. Kleinberg, and E´. Tardos. Maximizing two-terminal network reliability. Discrete Applied thespread of influencethrough a social network. In Mathematics, 21(3):185–198, 1988. KDD,pages 137–146, 2003. [3] R.E. Bryant. Graph-basedalgorithms for boolean [20] N.G. Kinnersley.The vertex separation numberof a function manipulation. Transactions on Computers, graph equals its path-width.Information Processing 100(8):677–691, 1986. Letters, 42(6):345–350, 1992. [4] W. Chen,C. Wang,and Y. Wang.Scalable influence [21] D.Knuth.The art of computerprogramming: Bitwise maximization for prevalentviral marketing in tricks& techniques;binary decision diagrams, volume large-scale social networks.In KDD, pages 1029–1038, 4, fascicle 1, 2009. 2010. [22] J. Leskovec, A.Krause, C. Guestrin, C. Faloutsos, [5] W. Chen,Y. Wang,and S. Yang.Efficient influence J. VanBriesen, and N.Glance. Cost-effectiveoutbreak maximization in social networks. InKDD, pages detection in networks. In KDD, pages 420–429, 2007. 199–208, 2009. [23] S.Minato, N.Ishiura, and S.Yajima. Shared binary [6] S.Cheng, H. Shen,J. Huang,G. Zhang, and decision diagram with attributed edges for efficient X.Cheng. Staticgreedy: solving the boolean function manipulation. In DAC, pages 52–57, scalability-accuracy dilemma in influence 1990. maximization. InCIKM,pages 509–518, 2013. [24] G. L. Nemhauser,L. A.Wolsey, and M. L. Fisher. An [7] E. Cohen, D.Delling, T. Pajor, and R.F. Werneck. analysisof approximationsfor maximizingsubmodular Sketch-basedinfluencemaximization and set functions—i. Mathematical Programming, computation: Scaling up with guarantees. In CIKM, 14(1):265–294, 1978. pages 629–638, 2014. [25] N.Ohsaka,T. Akiba,Y.Yoshida, and [8] P. Domingos and M. Richardson. Miningthe network K.Kawarabayashi. Fast and accurateinfluence valueof customers. In KDD,pages 57–66, 2001. maximization on large networks with pruned [9] S.Even, A.Itai, and A.Shamir. On thecomplexity of monte-carlo simulations. In AAAI,pages 138–144, time tableand multi-commodity flow problems. In 2014. FOCS, pages 184–193, 1975. [26] N.Ohsaka,T. Akiba,Y.Yoshida, and [10] J. Goldenberg, B. Libai, and E. Muller. Talk of the K.Kawarabayashi. Dynamicinfluenceanalysis in network: A complex systems look at theunderlying evolvingnetworks. VLDB, 9(12):1077–1088, 2016. process of word-of-mouth.Marketing Letters, [27] M. Richardson and P. Domingos. Mining 12(3):211–223, 2001. knowledge-sharing sites for viral marketing. In KDD, [11] J.Goldenberg, B.Libai, andE.Muller. Usingcomplex pages 61–70, 2002. systems analysis to advancemarketingtheory [28] K.Sekine,H. Imai, and S.Tani. Computing thetutte development: Modeling heterogeneity effects on new polynomial of a graph of moderate size. In product growth throughstochastic cellular automata. International Symposium on Algorithms and Academy of Marketing Science Review, 2001:1, 2001. Computation, pages 224–233. Springer,1995. [12] A.Goyal, W.Lu, and L. V.Lakshmanan.Simpath: [29] D.Sieling and I. Wegener. Reductionof obddsin An efficient algorithm for influencemaximization linear time. Information Processing Letters, underthe linear threshold model. In ICDM,pages 48(3):139–144, 1993. 211–220, 2011. [30] Y.Tang, Y. Shi,and X.Xiao. Influencemaximization [13] G. Hardy,C. Lucet,and N. Limnios. Computing in near-linear time: A martingale approach. In all-terminal reliability of stochastic networks with SIGMOD,pages 1539–1554, 2015. binary decision diagrams. In ASMDA,pages 17–20. [31] Y.Tang, X. Xiao, and Y.Shi. Influencemaximization: Citeseer, 2005. Near-optimaltime complexity meets practical [14] K.Inoue, T. Sato, M. Ishihata, Y.Kameya, and efficiency.In SIGMOD,pages 75–86, 2014. H.Nabeshima. Evaluating abductivehypothesesusing [32] L. G. Valiant.The complexity of enumeration and an em algorithm on bdds.In IJCAI,pages 810–815, reliability problems. SIAM Journal on Computing, 2009. 8(3):410–421, 1979. [15] Y.Inoueand S. Minato. Acceleration of ZDD [33] Z.Yan,C. Nie, R.Dong, X.Gao, and J. Liu. A novel construction for subgraph enumeration viapath-width OBDD-basedreliability evaluation algorithm for optimization. TCS-TR-A-16-80. Hokkaido University, wireless sensor networks on themulticast model. 2016. Mathematical Problems in Engineering, 2015, 2015. [16] M. Ishihata, Y.Kameya, T. Sato, and S. Minato. [34] R.Yoshinaka,T. Saitoh, J. Kawahara, K. Tsuruma, Propositionalizing theem algorithm by bdds.InLate H.Iwashita, and S.-i.Minato. Findingall solutions Breaking Papers of the 18th International Conference and instances of numberlinkand slitherlink byzdds. on Inductive Logic Programming, pages 44–49, 2008. Algorithms, 5(2):176–213, 2012.