Lines Matching defs:Graph
31 Graph::Graph()
38 Graph::~Graph()
44 void Graph::insert(Node *node)
49 node->graph = this;
53 void Graph::Edge::unlink()
73 const char *Graph::Edge::typeStr() const
87 Graph::Node::Node(void *priv) : data(priv),
88 in(0), out(0), graph(0),
95 void Graph::Node::attach(Node *node, Edge::Type kind)
119 assert(graph || node->graph);
120 if (!node->graph)
121 graph->insert(node);
122 if (!graph)
123 node->graph->insert(this);
126 graph->classifyEdges();
129 bool Graph::Node::detach(Graph::Node *node)
143 // Cut a node from the graph, deleting all attached edges.
144 void Graph::Node::cut()
151 if (graph) {
152 if (graph->root == this)
153 graph->root = NULL;
154 graph = NULL;
158 Graph::Edge::Edge(Node *org, Node *tgt, Type kind)
169 Graph::Node::reachableBy(const Node *node, const Node *term) const
173 const int seq = graph->nextSequence();
199 DFSIterator(Graph *graph, const bool preorder)
201 unsigned int seq = graph->nextSequence();
203 nodes = new Graph::Node * [graph->getSize() + 1];
206 nodes[graph->getSize()] = 0;
208 if (graph->getRoot()) {
209 graph->getRoot()->visit(seq);
210 search(graph->getRoot(), preorder, seq);
220 void search(Graph::Node *node, const bool preorder, const int sequence)
225 for (Graph::EdgeIterator ei = node->outgoing(); !ei.end(); ei.next())
239 Graph::Node **nodes;
244 IteratorRef Graph::iteratorDFS(bool preorder)
249 IteratorRef Graph::safeIteratorDFS(bool preorder)
257 CFGIterator(Graph *graph)
259 nodes = new Graph::Node * [graph->getSize() + 1];
262 nodes[graph->getSize()] = 0;
264 // TODO: argh, use graph->sequence instead of tag and just raise it by > 1
265 for (IteratorRef it = graph->iteratorDFS(); !it->end(); it->next())
266 reinterpret_cast<Graph::Node *>(it->get())->tag = 0;
268 if (graph->getRoot())
269 search(graph->getRoot(), graph->nextSequence());
284 void search(Graph::Node *node, const int sequence)
291 node = reinterpret_cast<Graph::Node *>(bb.pop().u.p);
297 for (Graph::EdgeIterator ei = node->outgoing(); !ei.end(); ei.next()) {
299 case Graph::Edge::TREE:
300 case Graph::Edge::FORWARD:
301 case Graph::Edge::DUMMY:
305 case Graph::Edge::BACK:
307 case Graph::Edge::CROSS:
324 Graph::Node **nodes;
329 IteratorRef Graph::iteratorCFG()
334 IteratorRef Graph::safeIteratorCFG()
339 void Graph::classifyEdges()
354 void Graph::classifyDFS(Node *curr, int& seq)
356 Graph::Edge *edge;
357 Graph::Node *node;
399 Graph::findLightestPathWeight(Node *a, Node *b, const std::vector<int> &weight)