Package org.gephi.graph.api

Examples of org.gephi.graph.api.UndirectedGraph


        directedGraph.addEdge(edge51);
        directedGraph.addEdge(edge54);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        d.calculateDistanceMetrics(graphModel.getGraph(), indicies, true, false);

        double radius = d.getRadius();
View Full Code Here


    public void testTwoConnectedNodesBetweenness() {
        GraphModel graphModel = GraphGenerator.generatePathUndirectedGraph(2);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] betweenness = metricsMap.get(GraphDistance.BETWEENNESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(betweenness[index1], 0.0);
    }
View Full Code Here

    public void testTwoConnectedNodesCloseness() {
        GraphModel graphModel = GraphGenerator.generatePathUndirectedGraph(2);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] closeness = metricsMap.get(GraphDistance.CLOSENESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(closeness[index1], 1.0);
    }
View Full Code Here

    public void testNullGraphBetweenness() {
        GraphModel graphModel = GraphGenerator.generateNullUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] betweenness = metricsMap.get(GraphDistance.BETWEENNESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(betweenness[index1], 0.0);
    }
View Full Code Here

    public void testNullGraphCloseness() {
        GraphModel graphModel = GraphGenerator.generateNullUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] closeness = metricsMap.get(GraphDistance.CLOSENESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(closeness[index1], 0.0);
    }
View Full Code Here

    public void testCompleteGraphBetweenness() {
        GraphModel graphModel = GraphGenerator.generateCompleteUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] betweenness = metricsMap.get(GraphDistance.BETWEENNESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(betweenness[index1], 0.0);
    }
View Full Code Here

    public void testCompleteGraphCloseness() {
        GraphModel graphModel = GraphGenerator.generateCompleteUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] closeness = metricsMap.get(GraphDistance.CLOSENESS);

        Node n1 = undirectedGraph.getNode("0");
        int index1 = indicies.get(n1);

        assertEquals(closeness[index1], 1.0);
    }
View Full Code Here

    public void testStarGraphBetweenness() {
        GraphModel graphModel = GraphGenerator.generateStarUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] betweenness = metricsMap.get(GraphDistance.BETWEENNESS);

        Node n1 = undirectedGraph.getNode("0");
        Node n2 = undirectedGraph.getNode("1");
        int index1 = indicies.get(n1);
        int index2 = indicies.get(n2);

        assertEquals(betweenness[index1], 10.0);
        assertEquals(betweenness[index2], 0.0);
View Full Code Here

    public void testStarGraphCloseness() {
        GraphModel graphModel = GraphGenerator.generateStarUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] closeness = metricsMap.get(GraphDistance.CLOSENESS);

        Node n1 = undirectedGraph.getNode("0");
        Node n2 = undirectedGraph.getNode("1");
        int index1 = indicies.get(n1);
        int index2 = indicies.get(n2);

        assertEquals(closeness[index1], 1.0);
        assertEquals(closeness[index2], 1.8);
View Full Code Here

    public void testCyclic5GraphBetweenness() {
        GraphModel graphModel = GraphGenerator.generateCyclicUndirectedGraph(5);

        GraphDistance d = new GraphDistance();
        d.initializeStartValues();
        UndirectedGraph undirectedGraph = graphModel.getUndirectedGraph();
        HashMap<Node, Integer> indicies = d.createIndiciesMap(undirectedGraph);

        HashMap<String, double[]> metricsMap = (HashMap) d.calculateDistanceMetrics(graphModel.getGraph(), indicies, false, false);
        double[] betweenness = metricsMap.get(GraphDistance.BETWEENNESS);

        Node n4 = undirectedGraph.getNode("3");
        int index4 = indicies.get(n4);

        assertEquals(betweenness[index4], 1.0);
    }
View Full Code Here

TOP

Related Classes of org.gephi.graph.api.UndirectedGraph

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.