|
Function
int size ();
Returns the number of vertices in the graph.
Parameters
None
Return value
The number of vertices that in the graph.
Example
#include "HKUAL_graph.h"
#include <iostream>
using namespace std;
using namespace HKUAL;
int main(){
DirectedGraph<string> g;
g.addVertex("A");
g.addVertex("B");
DirectedGraph<string> g2;
cout << g.size() << endl;
cout << g2.size() << endl;
return 0;
} |
Output
Time Complexity
, for is number of vertices.
|