当前位置: 首页>>代码示例>>C#>>正文


C# Cluster.AddSearchNode方法代码示例

本文整理汇总了C#中Cluster.AddSearchNode方法的典型用法代码示例。如果您正苦于以下问题:C# Cluster.AddSearchNode方法的具体用法?C# Cluster.AddSearchNode怎么用?C# Cluster.AddSearchNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cluster的用法示例。


在下文中一共展示了Cluster.AddSearchNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExpandCluster

    // Private Functions //
    // ExpandCluster                                                                                                     //
    // Requires and initial search node and a list of its neighbours, along with full list of search nodes for expansion //
    // Returns a Cluster Class object - which deals with its own variables                                               //
    private Cluster ExpandCluster( SearchNode initialPoint, List< SearchNode > neighbours, SearchNode[] nodesToBeSearched )
    {
        // Create new cluster
        Cluster cluster = new Cluster();

        // Flag and add initial point to cluster
        initialPoint.SetAsPartOfCluster( true );
        cluster.AddSearchNode( initialPoint );

        // Loop through passed neighbour points
        for( int i = 0; i < neighbours.Count; i++ ) {
            // If it has NOT been visited
            if( !neighbours[ i ].HasBeenVisited() ) {
                // Now flag as visited
                neighbours[ i ].SetVisited( true );

                // Get neighbours of each point
                List< SearchNode > localNeighbours = GetNeighbours( neighbours[ i ], nodesToBeSearched );

                // If this point has enough neighbours
                if( localNeighbours.Count >= mMinimumPoints ) {
                    for( int j = 0; j < localNeighbours.Count; j++ ) {
                        // If this point isnt already a neighbour or has NOT been previously visited
                        // Add it as a brand new neighbour
                        //if( ( !localNeighbours[ j ].IsNeighbour() ) && ( !localNeighbours[ j ].HasBeenVisited() ) ) {
                        if( !localNeighbours[ j ].HasBeenVisited() ) {
                            // Add ONLY add localNeighbours that are 'joined' with nodes in neighbours
                            if( CheckIfJoined( localNeighbours[ j ], neighbours ) ) {
                                neighbours.Add( localNeighbours[ j ] );
                            }
                        }
                    }

                    // If this point is not part of a cluster - flag and add it!
                    if( !neighbours[ i ].PartOfCluster() ) {
                        neighbours[ i ].SetAsPartOfCluster( true );
                        cluster.AddSearchNode( neighbours[ i ] );
                    }
                }
            }
        }

        // Return final cluster
        return cluster;
    }
开发者ID:tomob95,项目名称:Portfolio,代码行数:49,代码来源:ClusteringAlgorithm.cs


注:本文中的Cluster.AddSearchNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。