In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, a graph-structured stack (GSS) is a
directed acyclic graph
In mathematics, particularly graph theory, and computer science, a directed acyclic graph (DAG) is a directed graph with no directed cycles. That is, it consists of vertices and edges (also called ''arcs''), with each edge directed from one v ...
where each directed
path represents a
stack
Stack may refer to:
Places
* Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group
* Blue Stack Mountains, in Co. Donegal, Ireland
People
* Stack (surname) (including a list of people ...
.
The graph-structured stack is an essential part of
Tomita's algorithm, where it replaces the usual
stack
Stack may refer to:
Places
* Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group
* Blue Stack Mountains, in Co. Donegal, Ireland
People
* Stack (surname) (including a list of people ...
of a
pushdown automaton. This allows the algorithm to encode the nondeterministic choices in parsing an
ambiguous grammar, sometimes with greater efficiency.
In the following diagram, there are four stacks: , , , and .
:
Another way to simulate nondeterminism would be to duplicate the stack as needed. The duplication would be less efficient since vertices would not be shared. For this example, 16 vertices would be needed instead of 9.
:
Operations
GSSnode* GSS::add(GSSnode* prev, int elem)
void GSS::remove(GSSnode* node)
References
*Masaru Tomita. ''Graph-Structured Stack And Natural Language Parsing''. Annual Meeting of the Association of Computational Linguistics, 1988
*Elizabeth Scott, Adrian Johnstone ''GLL Parsing'
gll.pdf
Graph data structures
Application-specific graphs
{{Comp-sci-stub