public CommunityManager(IPartitionableGraph <TVertex, IEdge <TVertex> > graph)
 {
     if (graph == null)
     {
         throw new ArgumentNullException("Graph should be not null");
     }
     _graph = graph;
 }
        public GraphPartition(IPartitionableGraph <TVertex, IEdge <TVertex> > graph, PartitionType type)
        {
            Graph             = graph ?? throw new ArgumentNullException("The graph cannot be null.");
            _communityManager = new CommunityManager <TVertex>(graph);
            _communities      = new Dictionary <int, ICommunity <TVertex> >();
            switch (type)
            {
            case PartitionType.Singletone:
                int communityNumber = 0;
                foreach (var vertex in Graph.Vertices)
                {
                    _communities.Add(communityNumber, new Community <TVertex>(vertex));
                    communityNumber++;
                }
                break;

            default:
                throw new ArgumentException("Wrong partition type value.");
            }
        }
 public GraphPartition(IPartitionableGraph <TVertex, IEdge <TVertex> > graph) : this(graph, PartitionType.Singletone)
 {
 }
 public static CommunityManager <TVertex> Create <TVertex>(IPartitionableGraph <TVertex, IEdge <TVertex> > graph)
 {
     return(new CommunityManager <TVertex>(graph));
 }
Example #5
0
 public static IGraphPartition <TVertex> GetPartition(IPartitionableGraph <TVertex, IEdge <TVertex> > graph, Metrics.PartitionMetric <TVertex> metric)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public static IGraphPartition <TVertex> Create <TVertex>(IPartitionableGraph <TVertex, IEdge <TVertex> > graph)
 {
     return(new GraphPartition <TVertex>(graph));
 }