CSCI 133
View the step-by-step solution to:

# Real world PR x How do Course Hero View Homewe A Assignment 7 Assignment &amp; x Google Trans Adjacenty Lis Not secure / staffwww . full call .

http://staffwww.fullcoll.edu/aclifton/cs133/assignment7.html

http://staffwww.fullcoll.edu/aclifton/cs133/files/assign7_test.cpp

my graph.hpp look like this

Real world PR x
How do Course Hero
View Homewe
A Assignment 7
Assignment &amp; x
Not secure / staffwww . full call . edu / aclifton / est 30 / assignment / html
count nodes ( )
Returns the number of nodes in this graph
Should run in of1 ) time
int count nodes ( )
count edges ( )
Returns the total number of edges in this graph
should run in GIE ) time
int count edges ( )
count edges ( n )
Returns the number of outbound edges from node
Should run in QE ) time
int count edges ( Int n )
* ofs ( n )
Perform a breadth-first search , starting at node in ,
returning a
Doctor that Blues
distance to every other node . ( If a node is
reachable from n , then set its distance to INT MAX . )
should run in OFF + N ) time
sted : :vectors ints bots ( int n )
is connected ( @ , b )
Returns true if a path exists from node a to b
Should run in o (E + N ) time
bool is connected ( int a , int b )
Add any private data / function members you need
1 Type here to search

Real world PR x
How do Course Hero * View Homewor
A Assignment 7
Not secure / staffwww . full call . edu / aclifton / est 30 / assignment / html
Hipragna once
graph . hop
* Adjacenty - list graph implementation
include &lt;clinics / For INT HAX , INT HIN
include &lt;lists
Hinclude svector
class graphit
public
graph ( )
Construct a graph with a nodes and no edges , initially
graph ( int n )
add edge ( @ , b )
Add an edge from node a to node b . Note that self edges are not allowed
so attempting add edge ( a a ) should be ignored . Similarly , this is not
multigraph , so if an edge a - b already exists , a second one should
Ignored
in ONE ) time in the worst case
add edge ( int a , int b ) ;
has edge ( a , b )
Returns true if there is an edge from a to b . Should return false if
either a or b is out-of - range ( &lt; &amp; or &gt; = count nodes ( ) )
Should run in O ( E ) time
bool has edge ( int a , int b )
count nodes ( )
1 Type here to search

[email protected]: ~/cs133/assign7
31
32
33
2 graph : :graph (int n) {
34
35
void graph : : add_edge (int a, int b) {
36
node*
tmp;
tmp-
e=b ;
tmp-&gt;
-&gt;next=nullptr;
40
int graph : : count_nodes ( ) {
return n;
45
int graph : : count_edges ( ) {
int count=0;
for (int i=
t i=0;i&lt;n;i++) {
node *
while (a-&gt;next ! =nullptr) {
count++;
a=a-&gt;next ;
return count ;
int graph : : count_edges (int n) {
int count=0;
while (a-&gt;next !=nullptr) {
count++;
a=a-&gt;next ;
return count ;
bool graph : :has edge (int a,
node * t
int b) {
while (tmp-&gt;next ! =nullptr) {
if ( tmp-&gt;value==b)
return true
tmp=tmp-&gt;next ;
OUS WNFOO
return false;
vector&lt;int&gt; graph : :bfs (int n) {
graph . hpp + (31, 3)
c++ unix
Alt-g:
show bindings,
CtrlG:
open
help
O Type here to search
e 9 AM x
W
6 41)) . ENG
11:29 PM
12/1/2018

[email protected]: ~/cs133/assign7
O
5 struct list{
18
class graph
int n;
list*
public:
graph (int n) ;
void add edge (int a, int b) ;
bool has edge (int a,
int b) ;
int count_nodes ( )
int count edges ( ) ;
int count edges (
s ( int n)
vector&lt;int&gt;
bfs (int n) ;
bool is c
int b) ;
33
graph : : graph (int n) {
34
35
void graph : :add_edge (int a, int b) {
node *
tmp;
38
tmp-&gt;value=b;
tmp-&gt;next=nullptr ;
NE
int graph : : count_nodes ( ) {
return n;
14
45
int graph : : count_edges ( ) {
int count=0;
for (int i=0;i&lt;n ;i++) {
node *
while (a-&gt;next ! =nullptr) {
count++;
a=a-&gt;next ;
count;
int graph : : count_edges (int n) {
t=0 ;
while (a-&gt;next ! =nullptr) {
\$2
count++;
a=a-&gt;next ;
graph . hpp
31, 3)
c++ unix
Alt-g:
show bindings,
CtrlG:
open
help
O Type here to search
e 9 AM x
W
6 41)) . ENG
11:29 PM
12/1/2018

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents