/* Prints graph in dot language */ std::ostream& DirectionalGraph::print( std::ostream& out ) const{ out << "digraph DataFlowGraph{" << std::endl; /* Print nodes */ const_node_iterator node = getBeginNode(); const_node_iterator endNode = getEndNode(); for( ; node != endNode; node++ ){ out << *node << std::endl; } /* Print arrows between nodes */ node = getBeginNode(); endNode = getEndNode(); for( ; node != endNode; node++ ){ const node_set outArrows = getOutNodesSet(*node); const_node_iterator nodeOut = outArrows.begin(); const_node_iterator endNodeOut = outArrows.end(); for( ; nodeOut != endNodeOut; nodeOut++ ){ out << *node << "->" << *nodeOut << std::endl; } } out << '}' << std::endl; return out; }
//弹出栈 int pop(LinkStack* myLinkStack, char* value) { if (myLinkStack != nullptr && value != nullptr) { if (myLinkStack->topNode!=nullptr) { strcpy(value,getEndNode(&myLinkStack->pHeadNode)->pStr); deleteback(&myLinkStack->pHeadNode); myLinkStack->topNode = getEndNode(&myLinkStack->pHeadNode); return 1; } else { return 0; } } else { return 0; } }