public Vector3[] GenerateNodeSphericLocations(SphericGraphProperties sphericGraphProperties, out int[][] edges)
    {
        if (sphericGraphProperties.FloorsNodesCounts == null)
        {
            int[] floorNodesCounts = GraphGeneratorHelper.GenerateFloorNodesCounts(2, 2,
                                                                                   sphericGraphProperties.FloorsCount);
            sphericGraphProperties.FloorsNodesCounts = floorNodesCounts;
        }
        int nodesCount = sphericGraphProperties.FloorsNodesCounts.Sum(a => a);

        connections = new Edge[nodesCount, nodesCount];
        Vector3[] nodesLocations = _sphericGraphGenerator.GenerateGraph(sphericGraphProperties, out edges);
        return(nodesLocations);
    }
    public Vector3[] GenerateGraph(IGraphProperties graphProperties, out int[][] edges)
    {
        List <Vector3> nodes     = new List <Vector3>();
        List <int[]>   edgesList = new List <int[]>();

        Vector3[] lastNodesFloor    = null;
        Vector3[] currentNodesFloor = null;
        SphericGraphProperties sphericGraphProperties = graphProperties as SphericGraphProperties;

        float   radiusPart = sphericGraphProperties.Radius / sphericGraphProperties.FloorsCount;
        Vector3 partSize   = new Vector3(radiusPart / 2, radiusPart / 2, radiusPart / 2);

        for (int floorNo = 0; floorNo < sphericGraphProperties.FloorsCount; floorNo++)
        {
            float radiusFrom = sphericGraphProperties.Location.y + floorNo * radiusPart;
            float radiusTo   = sphericGraphProperties.Location.y + (floorNo + 1) * radiusPart;

            if (floorNo > 0)
            {
                lastNodesFloor = new Vector3[currentNodesFloor.Length];
                currentNodesFloor.CopyTo(lastNodesFloor, 0);
            }

            currentNodesFloor = GraphGeneratorHelper.GenerateNodeLocationsInSphereSlice(
                sphericGraphProperties.Location, radiusFrom, radiusTo, sphericGraphProperties.FloorsNodesCounts[floorNo],
                sphericGraphProperties.RandomizationPercentage, partSize);
            nodes.AddRange(currentNodesFloor);

            edgesList.AddRange(GraphGeneratorHelper.GetEdgesInCircle(currentNodesFloor, nodes));

            if (floorNo > 0)
            {
                edgesList.AddRange(GraphGeneratorHelper.GetEdgesBetweenTwoSetsAllToAll(lastNodesFloor, currentNodesFloor,
                                                                                       nodes, sphericGraphProperties.EdgesProbability, 2 * radiusPart));
            }
        }

        edges = edgesList.ToArray();
        return(nodes.ToArray());
    }
    public void Generate(GraphType graphType, IGraphProperties properties = null, int[][] powerDotLocations = null)
    {
        int[][]   edges          = null;
        Vector3[] nodesLocations = null;

        switch (graphType)
        {
        case GraphType.Conic:
        {
            ConicGraphProperties conicGraphProperties = (ConicGraphProperties)properties ?? new ConicGraphProperties
            {
                Location = transform.position,
                RandomizationPercentage = RandomizationPercentage,
                Height      = ConeHeight,
                FloorsCount = ConeFloorCount,
                BaseRadius  = ConeRadius
            };
            nodesLocations = GenerateNodeConicLocations(conicGraphProperties, out edges);
            break;
        }

        case GraphType.Cubic:
        {
            CubicGraphProperties cubicGraphProperties = (CubicGraphProperties)properties ?? new CubicGraphProperties
            {
                RandomizationPercentage = RandomizationPercentage,
                Location   = transform.position,
                PartsCount = CubePartsCount,
                Size       = CubeSize
            };
            nodesLocations = GenerateNodeCubicLocations(cubicGraphProperties, out edges);
            break;
        }

        case GraphType.Random:
        {
            RandomGraphProperties randomGraphProperties = (RandomGraphProperties)properties ?? new RandomGraphProperties
            {
                Location         = transform.position,
                NodesCount       = RandomNodesCount,
                EdgesProbability = RandomEdgesProbability,
                Size             = RandomCubeSize
            };
            nodesLocations = GenenerateNodeRandomLocations(randomGraphProperties, out edges);
            break;
        }

        case GraphType.Spheric:
        {
            SphericGraphProperties sphericGraphProperties = (SphericGraphProperties)properties ??
                                                            new SphericGraphProperties
            {
                RandomizationPercentage = RandomizationPercentage,
                Location         = transform.position,
                FloorsCount      = SphereFloorsCount,
                EdgesProbability = SphereEdgesProbability,
                Radius           = SphereRadius
            };
            nodesLocations = GenerateNodeSphericLocations(sphericGraphProperties, out edges);
            break;
        }

        case GraphType.Spiral:
        {
            SpiralGraphProperties spiralGraphProperties = (SpiralGraphProperties)properties ??
                                                          new SpiralGraphProperties
            {
                Location = transform.position,
                RandomizationPercentage = RandomizationPercentage,
                Height           = SpiralHeight,
                FloorsCount      = SpiralFloorCount,
                BaseRadius       = SpiralRadius,
                EdgesProbability = SpiralEdgesProbability
            };
            nodesLocations = GenerateNodeSpiralLocations(spiralGraphProperties, out edges);
            break;
        }
        }

        InitializeNodes(nodesLocations);
        InitializeEdges(this.Nodes, edges, powerDotLocations);
    }