You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prepare a dynamic network file (e.g. tiny_dyn_net.txt) with each line represents a graph event as follows:
+ 1 # add new node "1"
+ 2 # add new node "2"
+ 1 2 # add a new edge between nodes "1" and "2"
+ 2 3
+ 3 1
+ 1 4
+ 4 5
+ 5 6
+ 6 4
+ 2 5
+ 3 6
- 2 5 # delete the edge between nodes "2" and "5"
- 3 6
- 1 # delete the node "1"
Change to the src directory and open terminal from there (don't forget to add Julia to the environment variables PATH), and then using the following command to run ALPA on the dynamic network file.
julia main.jl tiny_dyn_net.txt
In the same directory of tiny_dyn_net.txt, you will get the output community file tiny_dyn_net.comm.
interactive mode
julia>using ALPA
julia> m =Dict{Int,Int}() # initialize nodes' membership
julia> g =Graph() # start with an empty graph
julia>lpa_addedge!(g, m, 1, 2) # add edge (1,2) and update partition
julia>lpa_addedge!(g, m, 2, 3)
julia>lpa_addedge!(g, m, 3, 1)
julia>lpa_addedge!(g, m, 1, 4)
julia>lpa_addedge!(g, m, 4, 5)
julia>lpa_addedge!(g, m, 5, 6)
julia>lpa_addedge!(g, m, 6, 4)
julia> m
Dict{Int64,Int64} with 6 entries:4=>52=>13=>15=>56=>51=>1
julia>lpa_addedge!(g, m, 2, 5)
julia> m
Dict{Int64,Int64} with 6 entries:4=>12=>13=>15=>16=>11=>1
julia>lpa_deleteedge!(g, m, 2, 5)
julia> m
Dict{Int64,Int64} with 6 entries:4=>32=>23=>25=>36=>31=>2