00001 #ifndef mmn_analyze_graph_h_ 00002 #define mmn_analyze_graph_h_ 00003 00004 //: 00005 // \file 00006 // \brief Analyze a graph to deduce the dependency order. 00007 // \author Tim Cootes 00008 00009 #include <mmn/mmn_arc.h> 00010 #include <mmn/mmn_dependancy.h> 00011 #include <vcl_vector.h> 00012 00013 //: Given a graph with n.size() nodes and arc.size() arcs, deduce dependencies 00014 // If returns true, then dep is an ordered list of dependencies 00015 // allowing us solve a minimisation problem one node at a time. 00016 // If it returns false, then the graph cannot be decomposed into 00017 // a sequence of single or pairwise dependencies. 00018 // If dep[i].n_dep==1 for all i, then the graph is a tree, and 00019 // reversing the order of dep gives a means of traversing from the 00020 // root to the leaves. The original order gives a method of 00021 // visiting every node only after any child/leaf nodes have been 00022 // visited first. 00023 bool mmn_analyze_graph(const vcl_vector<unsigned>& n, 00024 const vcl_vector<mmn_arc>& arc, 00025 vcl_vector<mmn_dependancy>& dep, 00026 unsigned& max_arcs); 00027 00028 00029 #endif // mmn_analyze_graph_h_