struct Vertex<V> {
	value: V,
	neighbours: Vec<Weak<RefCell<Vertex<V>>>>,
}
// ...
fn dft_helper(start: Rc<RefCell<Vertex<V>>>, f: &impl Fn(&V), s: &mut Vec<*const Vertex<V>>) {
	s.push(start.as_ptr());
	(f)(&start.borrow().value);
	for n in &start.borrow().neighbours {
		let n = n.upgrade().expect("Invalid neighbor");
		if s.iter().all(|&p| p != n.as_ptr()) {
			Self::dft_helper(n, f, s);
		}
	}
}
		
		
	#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 50   // size of symbol table
#define MAX 20    // max length of identifier
// Structure for symbol table entry
typedef struct {
    char name[MAX];
    char type[MAX];
} Symbol;
Symbol table[SIZE];
int count = 0;
// Function to insert symbol
void insert(char *name, char *type) {
    if (count < SIZE) {
        strcpy(table[count].name, name);
        strcpy(table[count].type, type);
        count++;
        printf("Inser
		
		
	#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define SIZE 50   // size of symbol table
#define MAX 20    // max length of identifier
// Structure for symbol table entry
typedef struct {
    char name[MAX];
    char type[MAX];
} Symbol;
Symbol table[SIZE];
int count = 0;
// Function to insert symbol
void insert(char *name, char *type) {
    if (count < SIZE) {
        strcpy(table[count].name, name);
        strcpy(table[count].type, type);
        count++;
        printf("Inser
		
		
	void dfs(Node& root, std::function<void(Node*)> f) {
  std::stack<Node*> queue;
  queue.push(&root);
  std::unordered_set<const Node*> visited;
  while (!queue.empty()) {
    Node* const node = queue.top();
    queue.pop();
    f(node);
    visited.insert(node);
    for (Node* const neighbor : node->neighbors) {
      if (visited.find(neighbor) == visited.end()) {
        queue.push(neighbor);
      }
    }
  }
}