gnode.h

来自「贪婪算法合集,包括二分覆盖,单源最短路径,拓扑排序,机器调度问题」· C头文件 代码 · 共 32 行

H
32
字号

#ifndef GraphNode_
#define GraphNode_

#include<iostream>
using namespace std;

template <class T> class LinkedWDigraph;
template <class T> class LinkedWGraph;
template <class T> class Chain;

template <class T>
class GraphNode {
   friend LinkedWDigraph<T>;
   friend LinkedWGraph<T>;
   friend Chain<T>;
   public:
      int operator !=(GraphNode<T> y) const
      {return (vertex != y.vertex);}
      void Output(ostream& out) const
      {out << vertex << " " << weight << " ";}
   private:
      int vertex;  // second vertex of edge
      T weight;    // edge weight
};

template <class T>
ostream& operator<<(ostream& out, GraphNode<T> x)
   {x.Output(out); return out;}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?