question: public static Clusters convertToClusters ( Graph clusterGraph , List < Node > measuredVariables ) { List < String > latents = new ArrayList < > ( ) ; Clusters clusters = new Clusters ( ) ; clusterGraph = GraphUtils . replaceNodes ( clusterGraph , measuredVariables ) ; for ( Node node : clusterGraph . getNodes ( ) ) { if ( ! measuredVariables . contains ( node ) ) { latents . add ( node . getName ( ) ) ; } } Collections . sort ( latents ) ; for ( int i = 0 ; i < latents . size ( ) ; i ++ ) { String name = latents . get ( i ) ; clusters . setClusterName ( i , name ) ; Node latent = clusterGraph . getNode ( name ) ; List < Node > measured = clusterGraph . getNodesOutTo ( latent , Endpoint . ARROW ) ; for ( Node _node : measured ) { if ( measuredVariables . contains ( _node ) ) { clusters . addToCluster ( i , _node . getName ( ) ) ; } } } return clusters ; }
target:  Converts a disconnected multiple indicator model into a set of clusters. Assumes the given graph contains a number of latents Li, i = 0,...,n-1, for each of which there is a list of indicators Wj, j = 0,...,m_i-1, such that , Li-->Wj. Returns a Clusters object mapping i to Wj. The name for cluster i is set to Li.