IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
dependency_graph.h
Go to the documentation of this file.
1 /**
2  * \file IMP/dependency_graph.h
3  * \brief Build dependency graphs on models.
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPKERNEL_DEPENDENCY_GRAPH_H
10 #define IMPKERNEL_DEPENDENCY_GRAPH_H
11 
12 #include <IMP/kernel_config.h>
13 #include "base_types.h"
14 #include <IMP/base_macros.h>
15 #include "internal/utility.h"
16 #include <boost/graph/adjacency_list.hpp>
17 #include "ModelObject.h"
18 
19 IMPKERNEL_BEGIN_NAMESPACE
20 
21 /*
22  Implementations in Model_dependency.cpp
23  */
24 
25 //! Directed graph on the interactions between the various objects in the model.
26 /** The vertices are named by the associated Object*. There
27  is an edge from a to b, if a is an input to b. For example, there
28  is an edge from a particle to a restraint if the restraint directly
29  reads the particle.
30 
31  See
32  \ref dependencies "Dependencies" for more information about dependencies.
33 */
34 IMP_GRAPH(DependencyGraph, bidirectional, ModelObject *, int,
35  internal::show_dg_node(vertex, out));
36 
37 class Model;
38 
39 /** The dependency graph captures the interactions between Restraint,
40  ScoreState and Particle objects. The graph has a directed edge if the source
41  of the edge is an input for the target of the edge or the target
42  of the edge is an output for the source. eg, there
43  is an edge connecting a Container to the Restraint which gets
44  its particles from the Container.
45  \see get_pruned_dependency_graph()
46 */
47 IMPKERNELEXPORT DependencyGraph get_dependency_graph(Model *m);
48 
49 /** The pruned dependency graph merges all particles which have the
50  same dependencies to produce a simpler graph.
51 */
53 
54 IMPKERNELEXPORT ScoreStatesTemp
55  get_required_score_states(ModelObject *p, const ModelObjectsTemp &all,
56  const DependencyGraph &dg,
57  const DependencyGraphVertexIndex &index);
58 IMPKERNELEXPORT ParticlesTemp
59  get_dependent_particles(ModelObject *p, const ModelObjectsTemp &all,
60  const DependencyGraph &dg,
61  const DependencyGraphVertexIndex &index);
62 
63 #ifndef IMP_DOXYGEN
64 
65 //! Return all ScoreStates that are required by this Particle.
66 /** \note The list may contain duplicates. */
67 IMPKERNELEXPORT ScoreStatesTemp
68  get_required_score_states(Model *m, ParticleIndex pi);
69 
70 #endif
71 
72 IMPKERNEL_END_NAMESPACE
73 
74 #endif /* IMPKERNEL_DEPENDENCY_GRAPH_H */
Basic types used by IMP.
DependencyGraph get_dependency_graph(Model *m)
boost::graph DependencyGraph
Directed graph on the interactions between the various objects in the model.
#define IMP_GRAPH(Name, directionality, VertexData, EdgeData, ShowVertex)
Define a graph object in IMP.
Definition: graph_macros.h:29
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Base class for objects in a Model that depend on other objects.
Definition: ModelObject.h:28
Base class for objects in a Model that depend on other objects.
DependencyGraph get_pruned_dependency_graph(Model *m)
Various general useful macros for IMP.