Package util

Source Code of util.CompleteGraphGenerator

package util;

import core.Graphs.Graph;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
* Nothing software.
*/
public class CompleteGraphGenerator implements GraphGenerator {
    @Override
    public Object generate(int numberOfNodes) {
        int[][] adjacencyMatrix = new int[numberOfNodes][numberOfNodes];

        for (int i = 0; i < numberOfNodes; i++) {
            for (int j = 0; j < numberOfNodes; j++) {
                adjacencyMatrix[i][j] = 1;
            }
            adjacencyMatrix[i][i] = 0;
        }

        return new Graph(adjacencyMatrix);
    }
}
TOP

Related Classes of util.CompleteGraphGenerator

TOP
Copyright © 2018 www.massapi.com. 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.