Graph::isComplete

Function


bool isComplete();

Returns whether this graph is a complete graph or not.

Parameters

None

Return value

Return true if the graph is a complete graph, false otherwise.

Example

#include "HKUAL_graph.h"
#include <iostream>
using namespace std;
using namespace HKUAL;

int main(){
    int n;
Graph<string> g; g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addEdge("A","B"); g.addEdge("A","C"); g.addEdge("A","D"); g.addEdge("B","C"); g.addEdge("B","D"); g.addEdge("C","D"); if (g.isComplete()) cout << "Yes" << endl; else cout << "No" << endl; return 0; }

Output

Yes

Time Complexity

, for is total number of vertives.

© The University of Hong Kong Algorithms Library - hkual@cs.hku.hk