本文整理汇总了C++中MyStack::stack_push方法的典型用法代码示例。如果您正苦于以下问题:C++ MyStack::stack_push方法的具体用法?C++ MyStack::stack_push怎么用?C++ MyStack::stack_push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyStack
的用法示例。
在下文中一共展示了MyStack::stack_push方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _GetComponent
int Graph::_GetComponent(int i,int * row)
{
MyStack * stack;
int n=0,j,tmp,result[1000],result_e[1000],neib_no=0,k;
stack = new MyStack;
row[n++] = i;
stack->stack_push(i,0);
while(stack->stack_pop(&j,&tmp)!=-1)
{
neib_no = GetNeighborNodeAndEdge(j, result,result_e);
for(k=0;k<neib_no;k++)
{
if(node_list[result[k]].color==0 && edge_list[result_e[k]].weight > 0.5) // hasn't been dried
{
row[n++] = result[k];
stack->stack_push(result[k],0);
node_list[result[k]].color=1;
}
}
};
row[n] = -1;
delete stack;
return n;
}
示例2: _GetComponentAff
int Graph::_GetComponentAff(double *A,int size,bool * node_list,int i,int * row)
{
MyStack * stack;
int n=0,j,tmp,k;
stack = new MyStack(size);
row[n++] = i;
stack->stack_push(i,0);
while(stack->stack_pop(&j,&tmp)!=-1)
{
for(k=0;k<size;k++)
{
if(A[j*size+k]>0.0000001 && node_list[k]==false)
{
row[n++] = k;
stack->stack_push(k,0);
node_list[k] = true;
}
}
};
row[n] = -1;
delete stack;
return n+1;
}
示例3: Reachable
// reachability test, from ni -> nj, according to weight
bool Graph::Reachable(int ni, int nj)
{
MyStack * stack;
int tmp,result[1000],result_e[1000],neib_no=0,k;
int nt,i;
for(i=0;i<node_num;i++)
NODE_PTR(i)->color = 0;
stack = new MyStack;
stack->stack_push(ni,0);
NODE_PTR(i)->color = 1;
while(stack->stack_pop(&nt,&tmp)!=-1)
{
neib_no = GetNeighborNodeAndEdge(nt, result,result_e);
for(k=0;k<neib_no;k++)
{
if(result[k]==nj && EDGE_PTR(result_e[k])->weight > 0.5)
{
delete stack;
return true;
}
if(NODE_PTR(result[k])->color==0 && EDGE_PTR(result_e[k])->weight > 0.5) // hasn't been dried
{
stack->stack_push(result[k],0);
NODE_PTR(result[k])->color=1;
}
}
};
delete stack;
return false;
}