Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Graph 图表:检测循环中的循环_Graph - Fatal编程技术网

Graph 图表:检测循环中的循环

Graph 图表:检测循环中的循环,graph,Graph,给你一个无向图 众所周知,图将包含很少的圈。给出一些指针来检测我们是否有一个循环,其中有一个较小的循环。如果是,则打印较大的循环节点和较小的循环节点 这里1,2,9,8,6,5,1的内部循环是5,3,4,6,5 Assume we have few functions already defined for us . You can leverage them to build over these . class graph { private:int n; i

给你一个无向图

众所周知,图将包含很少的圈。给出一些指针来检测我们是否有一个循环,其中有一个较小的循环。如果是,则打印较大的循环节点和较小的循环节点

这里1,2,9,8,6,5,1的内部循环是5,3,4,6,5

Assume we have few functions already defined for us . You can leverage them to build over these . 
   class graph
{
    private:int n;
        int **a;
        int *reach;
        int *pos;
    public:graph(int k=10);
        void create();
        void dfs();
        void dfs(int v,int label);
        int begin(int v);
        int nextvert(int v);
};

创建循环列表和无节点的节点哈希

所以循环A。。。包含4个节点和散列Q、W、E、R 循环B。。。包含5个节点和散列的W、E、R、A、S


现在搜索具有公共节点的循环。。。如果您发现,那么您有一些具有公共边的循环

这是一个家庭作业问题吗?否。。在amazon.com(印度0