Question: Cut vertex procedure?

I need to write a procedure that returns the cut vertices of a graph, but I think I'm having trouble defining my local variables. This is what I have so far.  I think my error might be in defining H since that's the line the error message I get keeps referencing.  Am I defining H incorrectly or in the wrong spot? Any advice would be appreciated. Thanks


cutvertices := proc (G)

local numvertices::integer, currentvertex, i::integer, H;

description "Returns a set of all the cut-vertices of the given graph";

numvertices := nops(Vertices(G));

for i to numvertices do

currentvertex := Vertices(G)[i]

H:=DeleteVertex(G, currentvertex)

 

if nops(ConnectedComponents(G)) = nops(ConnectedComponents(H)) then print(currentvertex)

end if;

end do;

end proc:

Please Wait...