12 // struct NodeType {bfs_node_data<TestGraph> bfs;};
13 struct NodeType {bool isVis;};
15 vector<NodeType> nodes;
22 NodeIterator &operator ++() { n++; return *this;}
23 NodeType &operator *() const { return G->nodes[n];}
24 NodeType *operator ->() const { return &(G->nodes[n]);}
25 bool isValid() const {return n<=5000;}
26 int Index() {return n;} //csak a kiirashoz kell
29 void GetFirst(NodeIterator &i) {i.G=this;i.n=1;}
36 int gcd() { int a=f;int b=t;int c;while((c=a%b)) {a=b;b=c;} ; return b;}
37 OutEdgeIterator &operator ++() {while(++t<=5000&&gcd()==1);return *this;}
38 bool isValid() const {return t<=5000;}
39 NodeIterator From() const {NodeIterator i; i.G=G;i.n=f;return i;}
40 NodeIterator To() const {NodeIterator i; i.G=G;i.n=t;return i;}
41 NodeIterator Anode() const {return From();}
42 NodeIterator Bnode() const {return To();}
45 typedef OutEdgeIterator EdgeIterator;
46 void GetFirst(OutEdgeIterator &i,const NodeIterator &n)
47 {i.G=this;i.f=n.n;i.t=0;++i;}
49 IGraph() : nodes(5001) {}
55 // class_element_map<IGraph::NodeIterator,
58 // &IGraph::NodeType::isVis> visited;
59 struct _visited_map_t {
60 typedef bool value_type;
61 void Put(const IGraph::NodeIterator &n,const value_type &t) { n->isVis=t; }
62 value_type Get(const IGraph::NodeIterator &n) const { return n->isVis; }
65 typedef IGraph::EdgeIterator value_type;
66 void Put(const IGraph::NodeIterator &n,const value_type &t)
67 { cout << t.From().Index() << "->" << t.To().Index() << '\n'; }
69 do_nothing_map dist; //node->int (W)
70 do_nothing_map priority; //node->int (W)
79 IGraph::NodeIterator in;