/usr/include/JAGS/graph/Graph.h is in jags 3.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #ifndef GRAPH_H_
#define GRAPH_H_
#include <set>
#include <vector>
class Node;
/**
* A graph is a container class for (pointers to) Nodes. A Node may
* belong to several Graphs. Further, if Node N is in graph G, then
* there is no requirement that the parents or children of N lie in G.
*
* @short Container class for nodes
*/
class Graph {
std::set<Node*> _nodes;
/* forbid copying */
Graph(Graph const &orig);
Graph &operator=(Graph const &rhs);
public:
/**
* Constructs an empty graph.
*/
Graph();
/**
* Adds node to graph.
*/
void add(Node *node);
/**
* Removes node from graph.
*/
void remove(Node *node);
/**
* Checks to see whether the node is contained in the Graph.
*/
bool contains(Node const *node) const;
/**
* Removes all nodes from the graph
*/
void clear();
/**
* The number of nodes in the graph.
*/
unsigned int size() const;
/**
* Checks if the parents and children of every node in the
* graph are also contained in the graph.
*/
bool isClosed() const;
/**
* The set of nodes contained in the graph
*/
std::set<Node*> const &nodes() const;
/**
* Adds all nodes in the graph to the given vector
*/
void getNodes(std::vector<Node*> &nodes) const;
/**
* Adds all nodes in the graph to the given vector with partial
* ordering, so that if A is an ancestor of B, then B never appears
* before A in the vector (Note that if there is a path from A to B
* outside of the graph, then this is ignored).
*
* The graph must be acyclic.
*
* @param sorted Empty vector of Node pointers. On exit
* this vector will contain the sorted nodes.
*/
void getSortedNodes(std::vector<Node*> &sorted) const;
/**
* Static version of the getSortedNodes function which works with
* a set instead of a graph.
*/
static void getSortedNodes(std::set<Node*> &nodes, std::vector<Node*> &sorted);
};
#endif /* GRAPH_H_ */
|