예제 #1
0
class DensityUndirected(DensityDirected):
    """
    """
    _ui_connectivity_label = "Undirected (weighted/binary) connection matrix:"

    _ui_name = "Density Unirected"
    _ui_description = bct_description("density_und.m")
    _matlab_code = "[kden,N,K]  = density_und(A);"
class TransitivityBinaryUnDirected(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Transitivity Binary Undirected"
    _ui_description = bct_description("transitivity_bu.m")
    _matlab_code = "T = transitivity_bu(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        value = self.build_float_value_wrapper(result, 'T', "Transitivity Binary Undirected")
        return [value]
class TransitivityWeightedUnDirected(TransitivityBinaryUnDirected):
    """
    """
    _ui_connectivity_label = LABEL_CONN_WEIGHTED_UNDIRECTED

    _ui_name = "Transitivity Weighted undirected"
    _ui_description = bct_description("transitivity_wu.m")
    _matlab_code = "T = transitivity_wu(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.scaled_weights()
        result = self.execute_matlab(self._matlab_code, **kwargs)
        value = self.build_float_value_wrapper(result, 'T', "Transitivity Weighted Undirected")
        return [value]
class ClusteringCoefficientBU(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Clustering Coefficient BU"
    _ui_description = bct_description("clustering_coef_bu.m")
    _matlab_code = "C = clustering_coef_bu(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient BU")
        return [measure]
class ClusteringCoefficientWD(ClusteringCoefficient):
    """
    """
    _ui_connectivity_label = LABEL_CONN_WEIGHTED_DIRECTED

    _ui_name = "Clustering Coeficient WD"
    _ui_description = bct_description("clustering_coef_wd.m")
    _matlab_code = "C = clustering_coef_wd(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.scaled_weights()
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient WD")
        return [measure]
예제 #6
0
class TransitivityWeightedUnDirected(TransitivityBinaryUnDirected):
    """
    """
    _ui_name = "Transitivity Weighted undirected: " + LABEL_CONN_WEIGHTED_UNDIRECTED
    _ui_description = bct_description("transitivity_wu.m")
    _matlab_code = "T = transitivity_wu(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.scaled_weights()}

        result = self.execute_matlab(self._matlab_code, data=data)
        value = self.build_float_value_wrapper(result, 'T', "Transitivity Weighted Undirected")
        return [value]
예제 #7
0
class ClusteringCoefficientWD(ClusteringCoefficient):
    """
    """
    _ui_name = "Clustering Coeficient WD: " + LABEL_CONN_WEIGHTED_DIRECTED
    _ui_description = bct_description("clustering_coef_wd.m")
    _matlab_code = "C = clustering_coef_wd(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.scaled_weights()}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient WD")
        return [measure_index]
예제 #8
0
class CentralityEigenVector(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY

    _ui_name = "EigenVector Centrality"
    _ui_description = bct_description("eigenvector_centrality_und.m")
    _matlab_code = "v = eigenvector_centrality_und(CIJ)"

    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'v', connectivity,
                                                  "Eigen vector centrality")
        return [measure]
예제 #9
0
class Strength(Degree):
    """
    """
    _ui_connectivity_label = "Directed weighted connection matrix:"

    _ui_name = "Strength"
    _ui_description = bct_description("strengths_und.m")
    _matlab_code = "strength = strengths_und(CIJ);"


    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'strength', connectivity, "Node strength")
        return [measure]
예제 #10
0
class CentralityEdgeWeighted(CentralityNodeWeighted):
    """
    """
    _ui_name = "Edge Betweenness Centrality Weighted"
    _ui_description = bct_description("edge_betweenness_wei.m")
    _matlab_code = "[EBC,BC] = edge_betweenness_wei(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure1 = self.build_connectivity_measure(
            result, 'EBC', connectivity, "Edge Betweenness Centrality Matrix")
        measure2 = self.build_connectivity_measure(
            result, 'BC', connectivity, "Node Betweenness Centrality Vector")
        return [measure1, measure2]
예제 #11
0
class Strength(Degree):
    """
    """
    _ui_name = "Strength: Directed weighted connection matrix"
    _ui_description = bct_description("strengths_und.m")
    _matlab_code = "strength = strengths_und(CIJ);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'CIJ': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(
            result, 'strength', connectivity, "Node strength")
        return [measure_index]
class ClusteringCoefficientWU(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING
    _ui_connectivity_label = LABEL_CONN_WEIGHTED_UNDIRECTED

    _ui_name = "Clustering Coeficient WU"
    _ui_description = bct_description("clustering_coef_wu.m")
    _matlab_code = "C = clustering_coef_wu(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.scaled_weights()
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient WU")
        return [measure]
예제 #13
0
class StrengthWeights(Strength):
    """
    """
    _ui_name = "Strength and Weight"
    _ui_description = bct_description("strengths_und_sign.m")
    _matlab_code = "[Spos,Sneg,vpos,vneg] = strengths_und_sign(CIJ);"


    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure1 = self.build_connectivity_measure(result, 'Spos', connectivity, "Nodal strength of positive weights")
        measure2 = self.build_connectivity_measure(result, 'Sneg', connectivity, "Nodal strength of negative weights")
        value1 = self.build_float_value_wrapper(result, 'vpos', "Total positive weight")
        value2 = self.build_float_value_wrapper(result, 'vneg', "Total negative weight")
        return [measure1, measure2, value1, value2]
예제 #14
0
class ClusteringCoefficientWU(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Clustering Coeficient WU: " + LABEL_CONN_WEIGHTED_UNDIRECTED
    _ui_description = bct_description("clustering_coef_wu.m")
    _matlab_code = "C = clustering_coef_wu(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.scaled_weights()}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient WU")
        return [measure_index]
예제 #15
0
class Degree(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_DEGREE
    _ui_connectivity_label = "Undirected (binary/weighted) connection matrix:"

    _ui_name = "Degree"
    _ui_description = bct_description("degrees_und.m")
    _matlab_code = "deg = degrees_und(CIJ);"

    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(result, 'deg', connectivity,
                                                  "Node degree")
        return [measure]
예제 #16
0
class ClusteringCoefficient(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Clustering Coefficient BD: Binary directed connection matrix"
    _ui_description = bct_description("clustering_coef_bd.m")
    _matlab_code = "C = clustering_coef_bd(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(result, 'C', connectivity, "Clustering Coefficient BD")
        return [measure_index]
예제 #17
0
class SubgraphCentrality(CentralityNodeBinary):
    """
    """
    _ui_connectivity_label = "Adjacency matrix (binary)"

    _ui_name = "Subgraph centrality of a network"
    _ui_description = bct_description("subgraph_centrality.m")
    _matlab_code = "Cs = subgraph_centrality(CIJ);"

    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.binarized_weights
        result = self.execute_matlab(self._matlab_code, **kwargs)

        measure = self.build_connectivity_measure(result, 'Cs', connectivity,
                                                  "Subgraph Centrality")
        return [measure]
예제 #18
0
class CentralityKCorenessBD(CentralityNodeBinary):
    """
    """
    _ui_name = "K-coreness centrality BD"
    _ui_description = bct_description("kcoreness_centrality_bd.m")
    _matlab_code = "[coreness, kn] = kcoreness_centrality_bd(CIJ);"

    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.binarized_weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure1 = self.build_connectivity_measure(result, 'coreness',
                                                   connectivity,
                                                   "Node coreness BD")
        measure2 = self.build_connectivity_measure(result, 'kn', connectivity,
                                                   "Size of k-core")
        return [measure1, measure2]
예제 #19
0
class TransitivityBinaryUnDirected(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING

    _ui_name = "Transitivity Binary Undirected"
    _ui_description = bct_description("transitivity_bu.m")
    _matlab_code = "T = transitivity_bu(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        value = self.build_float_value_wrapper(result, 'T', "Transitivity Binary Undirected")
        return [value]
예제 #20
0
class StrengthISOS(Strength):
    """
    """
    _ui_name = "Instrength and Outstrength"
    _ui_description = bct_description("strengths_dir.m")
    _matlab_code = "[is,os,strength] = strengths_dir(CIJ);"


    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure1 = self.build_connectivity_measure(result, 'is', connectivity, "Node instrength")
        measure2 = self.build_connectivity_measure(result, 'os', connectivity, "Node outstrength")
        measure3 = self.build_connectivity_measure(result, 'strength', connectivity,
                                                   "Node strength (instrength + outstrength)")
        return [measure1, measure2, measure3]
예제 #21
0
class Degree(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_DEGREE

    _ui_name = "Degree: Undirected (binary/weighted) connection matrix"
    _ui_description = bct_description("degrees_und.m")
    _matlab_code = "deg = degrees_und(CIJ);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'CIJ': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(
            result, 'deg', connectivity, "Node degree")
        return [measure_index]
예제 #22
0
class CentralityEdgeWeighted(CentralityNodeWeighted):
    """
    """
    _ui_name = "Edge Betweenness Centrality Weighted"
    _ui_description = bct_description("edge_betweenness_wei.m")
    _matlab_code = "[EBC,BC] = edge_betweenness_wei(A);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'A': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index1 = self.build_connectivity_measure(
            result, 'EBC', connectivity, "Edge Betweenness Centrality Matrix")
        measure_index2 = self.build_connectivity_measure(
            result, 'BC', connectivity, "Node Betweenness Centrality Vector")
        return [measure_index1, measure_index2]
예제 #23
0
class CentralityKCorenessBD(CentralityNodeBinary):
    """
    """
    _ui_name = "K-coreness centrality BD"
    _ui_description = bct_description("kcoreness_centrality_bd.m")
    _matlab_code = "[coreness, kn] = kcoreness_centrality_bd(CIJ);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'CIJ': connectivity.binarized_weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index1 = self.build_connectivity_measure(
            result, 'coreness', connectivity, "Node coreness BD")
        measure_index2 = self.build_connectivity_measure(
            result, 'kn', connectivity, "Size of k-core")
        return [measure_index1, measure_index2]
예제 #24
0
class CentralityNodeWeighted(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY
    _ui_connectivity_label = "Weighted (directed/undirected)  connection matrix:"

    _ui_name = "Node Betweenness Centrality Weighted"
    _ui_description = bct_description("betweenness_wei.m")
    _matlab_code = "C = betweenness_wei(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(
            result, 'C', connectivity, "Node Betweenness Centrality Weighted",
            "Nodes")
        return [measure]
예제 #25
0
class CentralityNodeBinary(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY
    _ui_connectivity_label = LABEL_CONNECTIVITY_BINARY

    _ui_name = "Node Betweenness Centrality Binary"
    _ui_description = bct_description("betweenness_bin.m")
    _matlab_code = "C = betweenness_bin(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.binarized_weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure = self.build_connectivity_measure(
            result, 'C', connectivity, "Node Betweenness Centrality Binary",
            "Nodes")
        return [measure]
예제 #26
0
class SubgraphCentrality(CentralityNodeBinary):
    """
    """

    _ui_name = "Subgraph centrality of a network: Adjacency matrix (binary)"
    _ui_description = bct_description("subgraph_centrality.m")
    _matlab_code = "Cs = subgraph_centrality(CIJ);"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'CIJ': connectivity.binarized_weights}

        result = self.execute_matlab(self._matlab_code, data=data)

        measure_index = self.build_connectivity_measure(
            result, 'Cs', connectivity, "Subgraph Centrality")
        return [measure_index]
예제 #27
0
class DegreeIOD(Degree):
    """
    """
    _ui_connectivity_label = "Directed (binary/weighted) connection matrix:"

    _ui_name = "Indegree and outdegree"
    _ui_description = bct_description("degrees_dir.m")
    _matlab_code = "[id,od,deg] = degrees_dir(CIJ);"


    def launch(self, connectivity, **kwargs):
        kwargs['CIJ'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)
        measure1 = self.build_connectivity_measure(result, 'id', connectivity, "Node indegree")
        measure2 = self.build_connectivity_measure(result, 'od', connectivity, "Node outdegree")
        measure3 = self.build_connectivity_measure(result, 'deg', connectivity, "Node degree (indegree + outdegree)")
        return [measure1, measure2, measure3]
예제 #28
0
class CentralityEigenVector(BaseUndirected):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY

    _ui_name = "EigenVector Centrality"
    _ui_description = bct_description("eigenvector_centrality_und.m")
    _matlab_code = "v = eigenvector_centrality_und(CIJ)"

    def launch(self, view_model):
        connectivity = self.get_connectivity(view_model)
        data = {'CIJ': connectivity.weights}

        result = self.execute_matlab(self._matlab_code, data=data)
        measure_index = self.build_connectivity_measure(
            result, 'v', connectivity, "Eigen vector centrality")
        return [measure_index]
예제 #29
0
class ParticipationCoefficient(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY
    _ui_connectivity_label = "Binary/weighted, directed/undirected connection matrix"

    _ui_name = "Participation Coefficient"
    _ui_description = bct_description("participation_coef.m")
    _matlab_code = "[Ci, Q]=modularity_dir(W); P = participation_coef(W, Ci);"

    def launch(self, connectivity, **kwargs):
        kwargs['W'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)

        measure = self.build_connectivity_measure(result, 'P', connectivity,
                                                  "Participation Coefficient")
        return [measure]
예제 #30
0
class ParticipationCoefficientSign(ParticipationCoefficient):
    """
    """
    _ui_name = "Participation Coefficient Sign"
    _ui_description = bct_description("participation_coef_sign.m")
    _matlab_code = "[Ci, Q]=modularity_dir(W); [Ppos, Pneg] = participation_coef_sign(W, Ci);"

    def launch(self, connectivity, **kwargs):
        kwargs['W'] = connectivity.weights
        result = self.execute_matlab(self._matlab_code, **kwargs)

        measure1 = self.build_connectivity_measure(
            result, 'Ppos', connectivity,
            "Participation Coefficient from positive weights")
        measure2 = self.build_connectivity_measure(
            result, 'Pneg', connectivity,
            "Participation Coefficient from negative weights")
        return [measure1, measure2]