Package org.gephi.io.importer.api

Examples of org.gephi.io.importer.api.EdgeWeightMergeStrategy


        //MANAGEMENT
    }

    protected void mergeParallelEdges(EdgeDraftImpl[] sources, EdgeDraftImpl dest) {
        EdgeWeightMergeStrategy mergeStrategy = parameters.getEdgesMergeStrategy();
        int count = 1 + sources.length;
        double sum = dest.getWeight();
        double min = dest.getWeight();
        double max = dest.getWeight();
        for (EdgeDraftImpl edge : sources) {
            sum += edge.getWeight();
            min = Math.min(min, edge.getWeight());
            max = Math.max(max, edge.getWeight());
        }
        double result = dest.getWeight();
        if (mergeStrategy.equals(EdgeWeightMergeStrategy.AVG)) {
            result = sum / count;
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.MAX)) {
            result = max;
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.MIN)) {
            result = min;
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.SUM)) {
            result = sum;
        }
        dest.setWeight(result);
    }
View Full Code Here


        }
        dest.setWeight(result);
    }

    protected void mergeDirectedEdges(EdgeDraftImpl source, EdgeDraftImpl dest) {
        EdgeWeightMergeStrategy mergeStrategy = parameters.getEdgesMergeStrategy();
        double result = dest.getWeight();
        if (mergeStrategy.equals(EdgeWeightMergeStrategy.AVG)) {
            result = (source.getWeight() + dest.getWeight()) / 2.0;
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.MAX)) {
            result = Math.max(source.getWeight(), dest.getWeight());
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.MIN)) {
            result = Math.min(source.getWeight(), dest.getWeight());
        } else if (mergeStrategy.equals(EdgeWeightMergeStrategy.SUM)) {
            result = source.getWeight() + dest.getWeight();
        }
        dest.setWeight(result);
    }
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.EdgeWeightMergeStrategy

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.