#include <cmath>
#include <map>
#include <string>
#include "graphchi_basic_includes.hpp"
#include "util/labelanalysis.hpp"
Classes | |
struct | bidirectional_label |
struct | CommunityDetectionProgram |
Typedefs | |
typedef vid_t | VertexDataType |
typedef bidirectional_label | EdgeDataType |
Functions | |
vid_t & | neighbor_label (bidirectional_label &bidir, vid_t myid, vid_t nbid) |
vid_t & | my_label (bidirectional_label &bidir, vid_t myid, vid_t nbid) |
int | main (int argc, const char **argv) |
Copyright [2012] [Aapo Kyrola, Guy Blelloch, Carlos Guestrin / Carnegie Mellon University]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A simple community detection algorithm based on label propagation. LPA-algorithm is explained in http://arxiv.org/pdf/0910.1154.pdf "Advanced modularity-specialized label propagation algorithm for detecting communities in networks X. Liu, T. Murata Tokyo Institute of Technology, 2-12-1 Ookayama, Meguro, Tokyo 152-8552, Japan
The algorithm is very similar to the connected components algorithm, but instead of vertex choosing the minimum label of its neighbor, it chooses the most frequent one.
However, because the operation (most frequent label) is not commutative, we need to store both vertices labels in an edge. See comment below, above the struct "bidirectional_label".
Note, that this algorithm is not very sophisticated and is prone to local minimas. If you want to use this seriously, try with different initial labeling. Also, a more sophisticated algorithm called LPAm should be doable on GraphChi.
typedef vid_t VertexDataType |
Type definitions. Remember to create suitable graph shards using the Sharder-program.