Package org.gephi.data.attributes.api

Examples of org.gephi.data.attributes.api.AttributeTable


        hgraph.readUnlock();
    }

    private double finalQ(int[] struct, double[] degrees, HierarchicalUndirectedGraph hgraph, AttributeModel attributeModel) {
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn modCol = nodeTable.getColumn(MODULARITY_CLASS);
        if (modCol == null) {
            modCol = nodeTable.addColumn(MODULARITY_CLASS, "Modularity Class", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
        }

        double res = 0;
        double[] internal = new double[degrees.length];
        for (Node n : hgraph.getNodes()) {
View Full Code Here


            AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
            GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();

            //Nodes
            List<NodePartition> nodePartitions = new ArrayList<NodePartition>();
            AttributeTable nodeTable = ac.getModel().getNodeTable();
            Graph graph = graphModel.getGraphVisible();
            for (AttributeColumn column : nodeTable.getColumns()) {
                if (PartitionFactory.isPartitionColumn(column) && PartitionFactory.isNodePartitionColumn(column, graph)) {
                    nodePartitions.add(PartitionFactory.createNodePartition(column));
                } else if (PartitionFactory.isDynamicPartitionColumn(column)) {
                    DynamicModel dynamicModel = model.getDynamicModel();
                    TimeInterval timeInterval = dynamicModel != null ? dynamicModel.getVisibleInterval() : null;
                    Estimator estimator = AttributeUtils.getDefault().isDynamicNumberColumn(column) ? model.getNumberEstimator() : model.getEstimator();
                    if (PartitionFactory.isDynamicNodePartitionColumn(column, graph, timeInterval, estimator)) {
                        nodePartitions.add(PartitionFactory.createNodePartition(column));
                    }
                }
            }
            model.setNodePartitions(nodePartitions.toArray(new NodePartition[0]));

            //Edges
            List<EdgePartition> edgePartitions = new ArrayList<EdgePartition>();
            AttributeTable edgeClass = ac.getModel().getEdgeTable();
            for (AttributeColumn column : edgeClass.getColumns()) {
                if (PartitionFactory.isPartitionColumn(column) && PartitionFactory.isEdgePartitionColumn(column, graph)) {
                    edgePartitions.add(PartitionFactory.createEdgePartition(column));
                } else if (PartitionFactory.isDynamicPartitionColumn(column)) {
                    DynamicModel dynamicModel = model.getDynamicModel();
                    TimeInterval timeInterval = dynamicModel != null ? dynamicModel.getVisibleInterval() : null;
View Full Code Here

                return;
            }
        }

        avgClusteringCoeff = 0;
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn clusteringCol = nodeTable.getColumn(CLUSTERING_COEFF);
        if (clusteringCol == null) {
            clusteringCol = nodeTable.addColumn(CLUSTERING_COEFF, "Clustering Coefficient", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }

        AttributeColumn triCount = nodeTable.getColumn("Triangles");
        if (triCount == null) {
            triCount = nodeTable.addColumn("Triangles", "Number of triangles", AttributeType.INT, AttributeOrigin.COMPUTED, new Integer(0));
        }

        for (int v = 0; v < N; v++) {
            if (network[v].length() > 1) {
                double cc = triangles[v];
View Full Code Here

    public void execute(HierarchicalGraph graph, AttributeModel attributeModel) {
        isCanceled = false;
        degreeDist = new HashMap<Float, Integer>();

        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn degCol = nodeTable.getColumn(WDEGREE);
        if (degCol == null) {
            degCol = nodeTable.addColumn(WDEGREE, "Weighted Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0);
        }

        graph.readLock();

        Progress.start(progress, graph.getNodeCount());
View Full Code Here

        inDegreeDist = new HashMap<Integer, Integer>();
        outDegreeDist = new HashMap<Integer, Integer>();
        degreeDist = new HashMap<Integer, Integer>();

        //Attributes cols
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn inCol = nodeTable.getColumn(INDEGREE);
        AttributeColumn outCol = nodeTable.getColumn(OUTDEGREE);
        AttributeColumn degCol = nodeTable.getColumn(DEGREE);
        if (graph instanceof DirectedGraph) {

            if (inCol == null) {
                inCol = nodeTable.addColumn(INDEGREE, "In Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0);
            }
            if (outCol == null) {
                outCol = nodeTable.addColumn(OUTDEGREE, "Out Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0);
            }
        }
        if (degCol == null) {
            degCol = nodeTable.addColumn(DEGREE, "Degree", AttributeType.INT, AttributeOrigin.COMPUTED, 0);
        }


        int i = 0;
View Full Code Here

            if ((done) || (isCanceled)) {
                break;
            }
        }

        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn authorityCol = nodeTable.getColumn(AUTHORITY);
        AttributeColumn hubsCol = nodeTable.getColumn(HUB);
        if (authorityCol == null) {
            authorityCol = nodeTable.addColumn(AUTHORITY, "Authority", AttributeType.FLOAT, AttributeOrigin.COMPUTED, new Float(0));
        }
        if (hubsCol == null) {
            hubsCol = nodeTable.addColumn(HUB, "Hub", AttributeType.FLOAT, AttributeOrigin.COMPUTED, new Float(0));
        }

        for (Node s : hgraph.getNodes()) {
            int s_index = indicies.get(s);
            AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
View Full Code Here

                break;
            }

        }

        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn pangeRanksCol = nodeTable.getColumn(PAGERANK);
        if (pangeRanksCol == null) {
            pangeRanksCol = nodeTable.addColumn(PAGERANK, "PageRank", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }

        for (Node s : hgraph.getNodes()) {
            int s_index = indicies.get(s);
            AttributeRow row = (AttributeRow) s.getNodeData().getAttributes();
View Full Code Here

        execute(graph, attributeModel);
    }

    public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel) {

        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn eigenCol = nodeTable.getColumn(EIGENVECTOR);
        if (eigenCol == null) {
            eigenCol = nodeTable.addColumn(EIGENVECTOR, "Eigenvector Centrality", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, new Double(0));
        }

        int N = hgraph.getNodeCount();
        hgraph.readLock();
View Full Code Here

            edgeTable.mergeTable(model.getEdgeTable());
        }

        for (AttributeTable table : model.getTables()) {
            if (table != model.getNodeTable() && table != model.getEdgeTable()) {
                AttributeTable existingTable = tableMap.get(table.getName());
                if (existingTable != null) {
                    ((AttributeTableImpl) existingTable).mergeTable(table);
                } else {
                    AttributeTableImpl newTable = new AttributeTableImpl(this, table.getName());
                    tableMap.put(newTable.getName(), newTable);
View Full Code Here

        execute(graph, attributeModel);
    }

    public void execute(Graph graph, AttributeModel attributeModel) {
        //Look if the result column already exist and create it if needed
        AttributeTable nodeTable = attributeModel.getNodeTable();
        AttributeColumn col = nodeTable.getColumn(AVG_EUCLIDEAN_DISTANCE);
        if (col == null) {
            col = nodeTable.addColumn(AVG_EUCLIDEAN_DISTANCE, "Average Euclidean Distance", AttributeType.DOUBLE, AttributeOrigin.COMPUTED, 0.0);
        }

        //Lock to graph. This is important to have consistent results if another
        //process is currently modifying it.
        graph.readLock();
View Full Code Here

TOP

Related Classes of org.gephi.data.attributes.api.AttributeTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.