dlvhex
2.5.0
|
Implements the rule dependency graph. More...
#include <include/dlvhex2/DependencyGraph.h>
Data Structures | |
struct | DependencyInfo |
Stores meta information about a single dependency in the graph. More... | |
struct | HeadBodyHelper |
See boost::graph. More... | |
struct | HeadBodyInfo |
Stores for a given ordinary atom where it occurs. More... | |
struct | HeadPredicateTag |
See boost::graph. More... | |
struct | IDTag |
See boost:graph. More... | |
struct | InBodyTag |
See boost::graph. More... | |
struct | InHeadTag |
See boost::graph. More... | |
struct | NodeInfo |
Meta information about a single node in the graph. More... | |
struct | NodeMappingInfo |
See boost:graph. More... | |
Public Types | |
typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::bidirectionalS, NodeInfo, DependencyInfo > | Graph |
typedef boost::graph_traits < Graph > | Traits |
typedef Graph::vertex_descriptor | Node |
typedef Graph::edge_descriptor | Dependency |
typedef Traits::vertex_iterator | NodeIterator |
typedef Traits::edge_iterator | DependencyIterator |
typedef Traits::out_edge_iterator | PredecessorIterator |
typedef Traits::in_edge_iterator | SuccessorIterator |
Public Member Functions | |
DependencyGraph (ProgramCtx &ctx, RegistryPtr registry) | |
Constructor. | |
virtual | ~DependencyGraph () |
Destructor. | |
void | createDependencies (const std::vector< ID > &idb, std::vector< ID > &createdAuxRules) |
Creates all dependencies and auxiliary input rules. | |
virtual void | writeGraphViz (std::ostream &o, bool verbose) const |
Output graph as graphviz source (dot file). | |
const Graph & | getInternalGraph () const |
Retrieves the internal graph. | |
Node | getNode (ID id) const |
std::pair< NodeIterator, NodeIterator > | getNodes () const |
Get range over all nodes. | |
const NodeInfo & | getNodeInfo (Node node) const |
Get node info given node. | |
const DependencyInfo & | getDependencyInfo (Dependency dep) const |
Get dependency info given dependency. | |
std::pair< PredecessorIterator, PredecessorIterator > | getDependencies (Node node) const |
Get dependencies (to predecessors) = arcs from this node to others. | |
std::pair< SuccessorIterator, SuccessorIterator > | getProvides (Node node) const |
Get provides (dependencies to successors) = arcs from other nodes to this one. | |
Node | sourceOf (Dependency d) const |
Get source of dependency = node that depends. | |
Node | targetOf (Dependency d) const |
Get target of dependency = node upon which the source depends. | |
const NodeInfo & | propsOf (Node n) const |
Get node properties. | |
NodeInfo & | propsOf (Node n) |
Get node properties. | |
const DependencyInfo & | propsOf (Dependency d) const |
Get dependency properties. | |
DependencyInfo & | propsOf (Dependency d) |
Get dependency properties. | |
unsigned | countNodes () const |
unsigned | countDependencies () const |
Protected Types | |
typedef boost::multi_index_container < NodeMappingInfo, boost::multi_index::indexed_by < boost::multi_index::hashed_unique < boost::multi_index::tag < IDTag >, > > > | NodeMapping |
typedef NodeMapping::index < IDTag >::type | NodeIDIndex |
typedef std::vector< Node > | NodeList |
Protected Member Functions | |
Node | createNode (ID id) |
Creates a node and updates the node mapping. | |
void | createNodesAndIntraRuleDependencies (const std::vector< ID > &idb, std::vector< ID > &createdAuxRules, HeadBodyHelper &hbh) |
Creates nodes for rules and external atoms. | |
void | createNodesAndIntraRuleDependenciesForRule (ID idrule, std::vector< ID > &createdAuxRules, HeadBodyHelper &hbh) |
Creates edges for dependencies within rules. | |
void | createNodesAndIntraRuleDependenciesForRuleAddHead (ID idat, const Rule &rule, Node nrule, HeadBodyHelper &hbh) |
Updates the graph after recognizing a head atom. | |
void | createNodesAndIntraRuleDependenciesForBody (ID idlit, ID idrule, const Tuple &body, Node nrule, HeadBodyHelper &hbh, std::vector< ID > &createdAuxRules, bool inAggregateBody=false) |
Updates the graph after recognizing a body atom. | |
void | createAuxiliaryRuleIfRequired (const Tuple &body, ID idlit, ID idat, Node neatom, const ExternalAtom &eatom, const PluginAtom *pluginAtom, std::vector< ID > &createdAuxRules, HeadBodyHelper &hbh) |
This method creates an auxiliary rule for the eatom wrt a rule body (not a rule!). | |
ID | createAuxiliaryRuleHeadPredicate (ID forEAtom) |
Create auxiliary rule head predicate (in registry) and return ID. | |
ID | createAuxiliaryRuleHead (ID idauxpred, const std::list< ID > &variables) |
Create auxiliary rule head (in registry) and return ID. | |
ID | createAuxiliaryRule (ID head, const std::list< ID > &body) |
Create auxiliary rule (in registry) and return ID. | |
void | createExternalPredicateInputDependencies (const HeadBodyHelper &hbh) |
Create "externalPredicateInput" dependencies. | |
void | createExternalPredicateInputDependenciesForInput (bool nonmonotonic, const NodeMappingInfo &ni_eatom, ID predicate, const HeadBodyHelper &hbh) |
Create "externalPredicateInput" dependencies. | |
void | createUnifyingDependencies (const HeadBodyHelper &hbh) |
Build all unifying dependencies ("{positive,negative}{Rule,Constraint}", "unifyingHead"). | |
void | createHeadHeadUnifyingDependencies (const HeadBodyHelper &hbh) |
Create "unifyingHead" dependencies. | |
void | createHeadBodyUnifyingDependencies (const HeadBodyHelper &hbh) |
Create "{positive,negative}{Rule,Constraint}" dependencies. | |
virtual void | writeGraphVizNodeLabel (std::ostream &o, Node n, bool verbose) const |
Writes a single node in dot format. | |
virtual void | writeGraphVizDependencyLabel (std::ostream &o, Dependency dep, bool verbose) const |
Writes a single dependency in dot format. | |
Protected Attributes | |
ProgramCtx & | ctx |
ProgramCtx. | |
RegistryPtr | registry |
Registry used for resolving IDs. | |
Graph | dg |
Instance of the internal graph. | |
NodeMapping | nm |
See boost::graph. | |
Private Member Functions | |
DependencyGraph (const Dependency &other) | |
Copy-constructor. |
Implements the rule dependency graph.
Definition at line 74 of file DependencyGraph.h.
typedef Graph::edge_descriptor DependencyGraph::Dependency |
Definition at line 179 of file DependencyGraph.h.
typedef Traits::edge_iterator DependencyGraph::DependencyIterator |
Definition at line 181 of file DependencyGraph.h.
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, NodeInfo, DependencyInfo> DependencyGraph::Graph |
Definition at line 175 of file DependencyGraph.h.
typedef Graph::vertex_descriptor DependencyGraph::Node |
Definition at line 178 of file DependencyGraph.h.
typedef NodeMapping::index<IDTag>::type DependencyGraph::NodeIDIndex [protected] |
Definition at line 207 of file DependencyGraph.h.
typedef Traits::vertex_iterator DependencyGraph::NodeIterator |
Definition at line 180 of file DependencyGraph.h.
typedef std::vector<Node> DependencyGraph::NodeList [protected] |
Definition at line 210 of file DependencyGraph.h.
typedef boost::multi_index_container< NodeMappingInfo, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag<IDTag>, > > > DependencyGraph::NodeMapping [protected] |
Definition at line 206 of file DependencyGraph.h.
typedef Traits::out_edge_iterator DependencyGraph::PredecessorIterator |
Definition at line 182 of file DependencyGraph.h.
typedef Traits::in_edge_iterator DependencyGraph::SuccessorIterator |
Definition at line 183 of file DependencyGraph.h.
typedef boost::graph_traits<Graph> DependencyGraph::Traits |
Definition at line 176 of file DependencyGraph.h.
DependencyGraph::DependencyGraph | ( | const Dependency & | other | ) | [private] |
Copy-constructor.
Not implemented on purpose because forbidden to use.
other | Other graph. |
DependencyGraph::DependencyGraph | ( | ProgramCtx & | ctx, |
RegistryPtr | registry | ||
) |
Constructor.
ctx | See DependencyGraph::ctx. |
registry | See DependencyGraph::registry. |
Definition at line 100 of file DependencyGraph.cpp.
DependencyGraph::~DependencyGraph | ( | ) | [virtual] |
Destructor.
Definition at line 106 of file DependencyGraph.cpp.
unsigned DependencyGraph::countDependencies | ( | ) | const [inline] |
Definition at line 403 of file DependencyGraph.h.
References dg.
unsigned DependencyGraph::countNodes | ( | ) | const [inline] |
Definition at line 401 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents().
ID DependencyGraph::createAuxiliaryRule | ( | ID | head, |
const std::list< ID > & | body | ||
) | [protected] |
Create auxiliary rule (in registry) and return ID.
Definition at line 612 of file DependencyGraph.cpp.
References Rule::body, Rule::head, ID::isExternalAtom(), Rule::kind, ID::MAINKIND_RULE, ID::PROPERTY_AUX, ID::PROPERTY_EXTERNALINPUTAUX, ID::PROPERTY_RULE_EXTATOMS, registry, and ID::SUBKIND_RULE_REGULAR.
Referenced by createAuxiliaryRuleIfRequired().
ID DependencyGraph::createAuxiliaryRuleHead | ( | ID | idauxpred, |
const std::list< ID > & | variables | ||
) | [protected] |
Create auxiliary rule head (in registry) and return ID.
idauxpre | Predicate to use in the auxiliary rule. |
variables | Variable to pass from the rule body to the head. |
Definition at line 576 of file DependencyGraph.cpp.
References ID::MAINKIND_ATOM, RawPrinter::print(), ID::PROPERTY_AUX, ID::PROPERTY_EXTERNALINPUTAUX, registry, ID::SUBKIND_ATOM_ORDINARYN, OrdinaryAtom::text, and Atom::tuple.
Referenced by createAuxiliaryRuleIfRequired().
ID DependencyGraph::createAuxiliaryRuleHeadPredicate | ( | ID | forEAtom | ) | [protected] |
Create auxiliary rule head predicate (in registry) and return ID.
forEAtom | ID of the external atom to create an auxiliary rule for. |
forEAtom
. Definition at line 570 of file DependencyGraph.cpp.
References registry.
Referenced by createAuxiliaryRuleIfRequired().
void DependencyGraph::createAuxiliaryRuleIfRequired | ( | const Tuple & | body, |
ID | idlit, | ||
ID | idat, | ||
Node | neatom, | ||
const ExternalAtom & | eatom, | ||
const PluginAtom * | pluginAtom, | ||
std::vector< ID > & | createdAuxRules, | ||
HeadBodyHelper & | hbh | ||
) | [protected] |
This method creates an auxiliary rule for the eatom wrt a rule body (not a rule!).
* for each eatom in the rule with variable inputs: * create auxiliary input predicate for its input * create auxiliary rule collecting its input, use as dependencies all positive literals (including eatoms) in the rule (this potentially creates many aux rules (cf.
This way we can use the method both for grounding aggregate bodies as well as rule bodies.
* For each eatom in the rule with variable inputs: * create auxiliary input predicate for its input * create auxiliary rule collecting its input, use as dependencies all positive literals (including eatoms) in the rule (this potentially creates many aux rules (cf. extatom2.hex)).
body | Rule body. |
idlit | Body literal. |
idat | Head predicate. |
neatom | Node of external atom eatom . |
eatom | ID of the external atom to create auxiliary rules for. |
createdAuxRules | Container to receive the auxiliary input rules. |
hbh | Information about heads and bodies. |
extatom2.hex))
Definition at line 357 of file DependencyGraph.cpp.
References ExternalAtom::auxInputMapping, ExternalAtom::auxInputMask, ExternalAtom::auxInputPredicate, PluginAtom::CONSTANT, createAuxiliaryRule(), createAuxiliaryRuleHead(), createAuxiliaryRuleHeadPredicate(), createNodesAndIntraRuleDependenciesForRule(), ctx, Logger::DBG, DBGLOG, DBGLOG_SCOPE, dg, DependencyGraph::DependencyInfo::externalConstantInput, PluginAtom::getInputType(), getNode(), ExternalAtom::inputs, Logger::Instance(), ProgramCtx::liberalSafetyChecker, LOG, RawPrinter::print(), Printer::printmany(), printrange(), printvector(), registry, Atom::tuple, and PluginAtom::TUPLE.
Referenced by createNodesAndIntraRuleDependenciesForBody().
void DependencyGraph::createDependencies | ( | const std::vector< ID > & | idb, |
std::vector< ID > & | createdAuxRules | ||
) |
Creates all dependencies and auxiliary input rules.
idb | IDB of the program. |
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 111 of file DependencyGraph.cpp.
References createExternalPredicateInputDependencies(), createNodesAndIntraRuleDependencies(), and createUnifyingDependencies().
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().
void DependencyGraph::createExternalPredicateInputDependencies | ( | const HeadBodyHelper & | hbh | ) | [protected] |
Create "externalPredicateInput" dependencies.
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 628 of file DependencyGraph.cpp.
References PluginAtom::checkInputArity(), PluginAtom::checkOutputArity(), createExternalPredicateInputDependenciesForInput(), DBGLOG, DBGLOG_SCOPE, ExternalAtom::getExtSourceProperties(), PluginAtom::getInputType(), PluginAtom::getPredicate(), ExternalAtom::inputMask, ExternalAtom::inputs, ID::isConstantTerm(), ExtSourceProperties::isNonmonotonic(), ID::isVariableTerm(), LOG, LOG_SCOPE, nm, ExternalAtom::pluginAtom, PluginAtom::PREDICATE, registry, and Atom::tuple.
Referenced by createDependencies().
void DependencyGraph::createExternalPredicateInputDependenciesForInput | ( | bool | nonmonotonic, |
const NodeMappingInfo & | ni_eatom, | ||
ID | predicate, | ||
const HeadBodyHelper & | hbh | ||
) | [protected] |
Create "externalPredicateInput" dependencies.
nonmonotonic | Specifies whether to create a monotonic or nonmonotonic dependency. |
ni_eatom | See boost::graph. |
predicate | Input predicate. |
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 698 of file DependencyGraph.cpp.
References dg, DependencyGraph::DependencyInfo::externalNonmonotonicPredicateInput, DependencyGraph::DependencyInfo::externalPredicateInput, DependencyGraph::NodeMappingInfo::id, DependencyGraph::HeadBodyHelper::infos, LOG, LOG_SCOPE, DependencyGraph::NodeMappingInfo::node, and propsOf().
Referenced by createExternalPredicateInputDependencies().
void DependencyGraph::createHeadBodyUnifyingDependencies | ( | const HeadBodyHelper & | hbh | ) | [protected] |
Create "{positive,negative}{Rule,Constraint}" dependencies.
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 898 of file DependencyGraph.cpp.
References DBGLOG, DBGLOG_SCOPE, DependencyGraph::HeadBodyHelper::infos, LOG, LOG_SCOPE, DependencyGraph::DependencyInfo::negativeRule, DependencyGraph::DependencyInfo::positiveConstraint, DependencyGraph::DependencyInfo::positiveRegularRule, printrange(), printvector(), and registry.
Referenced by createUnifyingDependencies().
void DependencyGraph::createHeadHeadUnifyingDependencies | ( | const HeadBodyHelper & | hbh | ) | [protected] |
Create "unifyingHead" dependencies.
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 788 of file DependencyGraph.cpp.
References DBGLOG, DBGLOG_SCOPE, DependencyGraph::DependencyInfo::disjunctive, DependencyGraph::HeadBodyHelper::infos, LOG_SCOPE, printvector(), registry, and DependencyGraph::DependencyInfo::unifyingHead.
Referenced by createUnifyingDependencies().
DependencyGraph::Node DependencyGraph::createNode | ( | ID | id | ) | [inline, protected] |
Creates a node and updates the node mapping.
id | Node to create. |
Definition at line 526 of file DependencyGraph.h.
References DBGLOG, dg, and nm.
Referenced by createNodesAndIntraRuleDependenciesForBody(), and createNodesAndIntraRuleDependenciesForRule().
void DependencyGraph::createNodesAndIntraRuleDependencies | ( | const std::vector< ID > & | idb, |
std::vector< ID > & | createdAuxRules, | ||
HeadBodyHelper & | hbh | ||
) | [protected] |
Creates nodes for rules and external atoms.
Create "positiveExternal" and "negativeExternal" dependencies. Create "externalConstantInput" dependencies and auxiliary rules. Fills HeadBodyHelper (required for efficient unification).
idb | IDB of the program. |
createdAuxRules | Container to receive the auxiliary input rules. |
hbh | Information about heads and bodies. |
Definition at line 128 of file DependencyGraph.cpp.
References createNodesAndIntraRuleDependenciesForRule(), DBGLOG, and DBGLOG_SCOPE.
Referenced by createDependencies().
void DependencyGraph::createNodesAndIntraRuleDependenciesForBody | ( | ID | idlit, |
ID | idrule, | ||
const Tuple & | body, | ||
Node | nrule, | ||
HeadBodyHelper & | hbh, | ||
std::vector< ID > & | createdAuxRules, | ||
bool | inAggregateBody = false |
||
) | [protected] |
Updates the graph after recognizing a body atom.
idlit | Body literal. |
idrule | ID of the rule literal idlit belongs to. |
body | Body of idrule . |
nrule | Node of body . |
hbh | Information about heads and bodies. |
createdAuxRules | Container to receive the auxiliary input rules. |
inAggregateBody | True to indicate that idlit is added to an aggregate body, false to add it to a regular rule body. |
Definition at line 190 of file DependencyGraph.cpp.
References ID::atomFromLiteral(), PluginAtom::checkInputArity(), PluginAtom::checkOutputArity(), createAuxiliaryRuleIfRequired(), createNode(), DBGLOG, DBGLOG_SCOPE, dg, ExternalAtom::getExtSourceProperties(), DependencyGraph::HeadBodyInfo::id, DependencyGraph::HeadBodyInfo::inBody, DependencyGraph::HeadBodyHelper::infos, DependencyGraph::HeadBodyInfo::inNegBodyOfRules, DependencyGraph::HeadBodyInfo::inPosBodyOfConstraints, DependencyGraph::HeadBodyInfo::inPosBodyOfRegularRules, ExternalAtom::inputs, ID::isAggregateAtom(), ID::isBuiltinAtom(), ID::isExternalAtom(), ID::isLiteral(), ExtSourceProperties::isMonotonic(), ID::isNaf(), ID::isOrdinaryAtom(), ID::isRegularRule(), AggregateAtom::literals, DependencyGraph::DependencyInfo::negativeExternal, nm, ExternalAtom::pluginAtom, DependencyGraph::DependencyInfo::positiveExternal, registry, and Atom::tuple.
Referenced by createNodesAndIntraRuleDependenciesForRule().
void DependencyGraph::createNodesAndIntraRuleDependenciesForRule | ( | ID | idrule, |
std::vector< ID > & | createdAuxRules, | ||
HeadBodyHelper & | hbh | ||
) | [protected] |
Creates edges for dependencies within rules.
idrule | ID of the rule to create the dependencies for. |
createdAuxRules | Container to receive the auxiliary input rules. |
hbh | Information about heads and bodies. |
Definition at line 324 of file DependencyGraph.cpp.
References ID::address, Rule::body, createNode(), createNodesAndIntraRuleDependenciesForBody(), createNodesAndIntraRuleDependenciesForRuleAddHead(), DBGLOG, DBGLOG_VSCOPE, Rule::head, ID::isRule(), and registry.
Referenced by createAuxiliaryRuleIfRequired(), and createNodesAndIntraRuleDependencies().
void DependencyGraph::createNodesAndIntraRuleDependenciesForRuleAddHead | ( | ID | idat, |
const Rule & | rule, | ||
Node | nrule, | ||
HeadBodyHelper & | hbh | ||
) | [protected] |
Updates the graph after recognizing a head atom.
idat | Head atom. |
rule | The rule atom idat belongs to. |
nrule | Node of rule . |
hbh | Information about heads and bodies. |
Definition at line 143 of file DependencyGraph.cpp.
References DBGLOG, Rule::head, DependencyGraph::HeadBodyInfo::headPredicate, DependencyGraph::HeadBodyInfo::id, DependencyGraph::HeadBodyHelper::infos, DependencyGraph::HeadBodyInfo::inHead, DependencyGraph::HeadBodyInfo::inHeadOfDisjunctiveRules, DependencyGraph::HeadBodyInfo::inHeadOfNondisjunctiveRules, ID::isAtom(), ID::isOrdinaryAtom(), DependencyGraph::HeadBodyInfo::oatom, registry, and Atom::tuple.
Referenced by createNodesAndIntraRuleDependenciesForRule().
void DependencyGraph::createUnifyingDependencies | ( | const HeadBodyHelper & | hbh | ) | [protected] |
Build all unifying dependencies ("{positive,negative}{Rule,Constraint}", "unifyingHead").
createdAuxRules | Container to receive the auxiliary input rules. |
Definition at line 732 of file DependencyGraph.cpp.
References createHeadBodyUnifyingDependencies(), and createHeadHeadUnifyingDependencies().
Referenced by createDependencies().
std::pair<PredecessorIterator, PredecessorIterator> DependencyGraph::getDependencies | ( | Node | node | ) | const [inline] |
Get dependencies (to predecessors) = arcs from this node to others.
Node | Some node of the graph. |
Definition at line 357 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents().
const DependencyInfo& DependencyGraph::getDependencyInfo | ( | Dependency | dep | ) | const [inline] |
Get dependency info given dependency.
dep | Some dependency of the graph. |
dep
. Definition at line 350 of file DependencyGraph.h.
References dg.
Referenced by writeGraphVizDependencyLabel().
const Graph& DependencyGraph::getInternalGraph | ( | ) | const [inline] |
Retrieves the internal graph.
Definition at line 323 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents().
Node DependencyGraph::getNode | ( | ID | id | ) | const [inline] |
Definition at line 327 of file DependencyGraph.h.
References nm.
Referenced by createAuxiliaryRuleIfRequired().
const NodeInfo& DependencyGraph::getNodeInfo | ( | Node | node | ) | const [inline] |
Get node info given node.
Node | Some node of the graph. |
node
. Definition at line 344 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents(), writeGraphViz(), and writeGraphVizNodeLabel().
std::pair<NodeIterator, NodeIterator> DependencyGraph::getNodes | ( | ) | const [inline] |
Get range over all nodes.
Node | Some node of the graph. |
node
. Definition at line 338 of file DependencyGraph.h.
References dg.
std::pair<SuccessorIterator, SuccessorIterator> DependencyGraph::getProvides | ( | Node | node | ) | const [inline] |
Get provides (dependencies to successors) = arcs from other nodes to this one.
Node | Some node of the graph. |
Definition at line 364 of file DependencyGraph.h.
References dg.
const NodeInfo& DependencyGraph::propsOf | ( | Node | n | ) | const [inline] |
Get node properties.
Node | Some node of the graph. |
n
. Definition at line 382 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents(), and createExternalPredicateInputDependenciesForInput().
NodeInfo& DependencyGraph::propsOf | ( | Node | n | ) | [inline] |
Get node properties.
Node | Some node of the graph. |
n
. Definition at line 387 of file DependencyGraph.h.
References dg.
const DependencyInfo& DependencyGraph::propsOf | ( | Dependency | d | ) | const [inline] |
Get dependency properties.
d | Some dependency of the graph. |
d
. Definition at line 392 of file DependencyGraph.h.
References dg.
DependencyInfo& DependencyGraph::propsOf | ( | Dependency | d | ) | [inline] |
Get dependency properties.
d | Some dependency of the graph. |
d
. Definition at line 397 of file DependencyGraph.h.
References dg.
Node DependencyGraph::sourceOf | ( | Dependency | d | ) | const [inline] |
Get source of dependency = node that depends.
d | Some depndency of the graph. |
d
. Definition at line 370 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents(), and writeGraphViz().
Node DependencyGraph::targetOf | ( | Dependency | d | ) | const [inline] |
Get target of dependency = node upon which the source depends.
d | Some dependency of the graph. |
d
. Definition at line 376 of file DependencyGraph.h.
References dg.
Referenced by ComponentGraph::calculateComponents(), and writeGraphViz().
void DependencyGraph::writeGraphViz | ( | std::ostream & | o, |
bool | verbose | ||
) | const [virtual] |
Output graph as graphviz source (dot file).
o | Stream to print the graph to. |
verbose | True to include more information. |
Definition at line 1042 of file DependencyGraph.cpp.
References graphviz::escape(), getNodeInfo(), DependencyGraph::NodeInfo::id, ID::isRule(), sourceOf(), targetOf(), writeGraphVizDependencyLabel(), and writeGraphVizNodeLabel().
void DependencyGraph::writeGraphVizDependencyLabel | ( | std::ostream & | o, |
Dependency | dep, | ||
bool | verbose | ||
) | const [protected, virtual] |
Writes a single dependency in dot format.
o | Stream to write to. |
dep | Dependency to output. |
verbose | True to include more detailed information. |
Definition at line 1020 of file DependencyGraph.cpp.
References DependencyGraph::DependencyInfo::externalConstantInput, DependencyGraph::DependencyInfo::externalNonmonotonicPredicateInput, DependencyGraph::DependencyInfo::externalPredicateInput, getDependencyInfo(), DependencyGraph::DependencyInfo::negativeExternal, DependencyGraph::DependencyInfo::negativeRule, DependencyGraph::DependencyInfo::positiveConstraint, DependencyGraph::DependencyInfo::positiveExternal, DependencyGraph::DependencyInfo::positiveRegularRule, and DependencyGraph::DependencyInfo::unifyingHead.
Referenced by writeGraphViz().
void DependencyGraph::writeGraphVizNodeLabel | ( | std::ostream & | o, |
Node | n, | ||
bool | verbose | ||
) | const [protected, virtual] |
Writes a single node in dot format.
o | Stream to write to. |
n | Node to output. |
verbose | True to include more detailed information. |
Definition at line 998 of file DependencyGraph.cpp.
References ID::address, getNodeInfo(), DependencyGraph::NodeInfo::id, ID::kind, RawPrinter::print(), registry, and ID::SUBKIND_SHIFT.
Referenced by writeGraphViz().
ProgramCtx& DependencyGraph::ctx [protected] |
Definition at line 286 of file DependencyGraph.h.
Referenced by createAuxiliaryRuleIfRequired().
Graph DependencyGraph::dg [protected] |
Instance of the internal graph.
Definition at line 290 of file DependencyGraph.h.
Referenced by countDependencies(), countNodes(), createAuxiliaryRuleIfRequired(), createExternalPredicateInputDependenciesForInput(), createNode(), createNodesAndIntraRuleDependenciesForBody(), getDependencies(), getDependencyInfo(), getInternalGraph(), getNodeInfo(), getNodes(), getProvides(), propsOf(), sourceOf(), and targetOf().
NodeMapping DependencyGraph::nm [protected] |
See boost::graph.
Definition at line 292 of file DependencyGraph.h.
Referenced by createExternalPredicateInputDependencies(), createNode(), createNodesAndIntraRuleDependenciesForBody(), and getNode().
RegistryPtr DependencyGraph::registry [protected] |
Registry used for resolving IDs.
Definition at line 288 of file DependencyGraph.h.
Referenced by createAuxiliaryRule(), createAuxiliaryRuleHead(), createAuxiliaryRuleHeadPredicate(), createAuxiliaryRuleIfRequired(), createExternalPredicateInputDependencies(), createHeadBodyUnifyingDependencies(), createHeadHeadUnifyingDependencies(), createNodesAndIntraRuleDependenciesForBody(), createNodesAndIntraRuleDependenciesForRule(), createNodesAndIntraRuleDependenciesForRuleAddHead(), and writeGraphVizNodeLabel().