-/* Copyright (C) 2006-2008 Joris Mooij [j dot mooij at science dot ru dot nl]
- Radboud University Nijmegen, The Netherlands
-
+/* Copyright (C) 2006-2008 Joris Mooij [joris dot mooij at tuebingen dot mpg dot de]
+ Radboud University Nijmegen, The Netherlands /
+ Max Planck Institute for Biological Cybernetics, Germany
+
This file is part of libDAI.
libDAI is free software; you can redistribute it and/or modify
// find new root clique (the one with maximal statespace overlap with ns)
size_t maxval = 0, maxalpha = 0;
for( size_t alpha = 0; alpha < nrORs(); alpha++ ) {
- size_t val = (ns & OR(alpha).vars()).states();
+ size_t val = VarSet(ns & OR(alpha).vars()).nrStates();
if( val > maxval ) {
maxval = val;
maxalpha = alpha;
}
-// first return value is treewidth
-// second return value is number of states in largest clique
-pair<size_t,size_t> treewidth( const FactorGraph & fg ) {
+/// Calculates upper bound to the treewidth of a FactorGraph
+/** \relates JTree
+ * \return a pair (number of variables in largest clique, number of states in largest clique)
+ */
+std::pair<size_t,size_t> treewidth( const FactorGraph & fg ) {
ClusterGraph _cg;
// Copy factors
for( size_t i = 0; i < ElimVec.size(); i++ ) {
if( ElimVec[i].size() > treewidth )
treewidth = ElimVec[i].size();
- if( ElimVec[i].states() > nrstates )
- nrstates = ElimVec[i].states();
+ size_t s = ElimVec[i].nrStates();
+ if( s > nrstates )
+ nrstates = s;
}
return pair<size_t,size_t>(treewidth, nrstates);