File: graph.h

package info (click to toggle)
iqtree 2.0.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 14,620 kB
  • sloc: cpp: 142,571; ansic: 57,789; sh: 275; python: 242; makefile: 95
file content (29 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * graph.h
 *
 *  Created on: Nov 14, 2013
 *      Author: olga
 */

#include <iostream>
#include <list>
#include <limits.h>

#ifndef GRAPH_H_
#define GRAPH_H_

using namespace std;

class Graph
{
    int V;    			// No. of vertices
    list<int> *adj;		// Pointer to an array containing adjacency lists
    bool isCyclicUtil(int v, bool visited[], bool *rs);  // used by isCyclic()

public:
    Graph(int V);   // Constructor
    void addEdge(int v, int w);   // to add an edge to graph
    bool isCyclic();    // returns true if there is a cycle in this graph
};

#endif