Module: graph_ops

Methods

(static) create_edge(graph, u, v, angle1, angle2, pop_symbol, push_symbol)

creates an edge between two vertices and draw it on the screen
Parameters:
Name Type Description
graph Object the graph in which we are creating a new edge
u string from vertex
v string to vertex
angle1 float the angle which the cursor left the from vertex
angle2 float the angle which the cursor entered the to vertex
pop_symbol string the symbol to pop on top of the stack
push_symbol string the symbol to push on top of the stack
Source:

(static) create_vertex(graph, x, y, radius)

create a vertex at the place the user has clicked
Parameters:
Name Type Description
graph Object the graph in which we are creating a new vertex
x float x position of the user mouse click wrt canvas
y float y position of the user mouse click wrt canvas
radius float the radius of the graphical element
Source:

(static) delete_edge(graph, edge)

delete an edge of the graph and draw
Parameters:
Name Type Description
graph Object the graph containing the edge we want to delete
edge Object the edge we want to get rid of
Source:

(static) delete_vertex(graph, v)

deletes a vertex by its name as well as its associated edges
Parameters:
Name Type Description
graph Object the graph containing the vertex v
v string the vertex you want to delete
Source:

(static) find_unused_name(graph)

go through the list of used names for a vertex and find the smallest unused
Parameters:
Name Type Description
graph Object the graph in which we are looking for an unused name
Source:
Returns:
the smallest unused name for a vertex

(static) NFA_to_DFA(NFA) → {Object}

Converts a graph of an NFA to a DFA
Parameters:
Name Type Description
NFA Object graph of an NFA to be converted to DFA
Source:
Returns:
- graph of a DFA equivalent to the NFA
Type
Object

(static) rename_edge(graph, edge, new_transition, new_pop, new_push, new_left_right)

rename the transition of an edge
Parameters:
Name Type Description
graph Object the graph containing the edge we want to rename
edge Object the edge object of which we want to rename the transition
new_transition string new transition symbol
new_pop string new pop symbol
new_push string new push symbol
new_left_right string new move (left or right)
Source:

(static) rename_vertex(graph, v, new_name, new_moore_output)

renames the vertex with the new name, if name exists, nothing will be changed and user will be prompted
Parameters:
Name Type Description
graph Object the graph containing the vertex v
v string the vertex to rename
new_name * new name of the vertex
new_moore_output string side effect of entering the state
Source:

(static) set_start(graph, v)

mark a vertex as start
Parameters:
Name Type Description
graph Object the graph containing the vertex v
v string name of the vertex
Source:

(static) toggle_final(graph, v)

toggle whether a vertex is accept
Parameters:
Name Type Description
graph Object the graph containing the vertex v
v string name of the vertex
Source:

(static) validate_edge(graph, edge) → {boolean}

check if edge has proper name and is not already in the graph
Parameters:
Name Type Description
graph Object the graph to check the edge against
edge Object the edge to validate
Source:
Returns:
true iff edge valid
Type
boolean

(inner) combine_state_labels(states) → {string}

Parameters:
Name Type Description
states Array.<string> a list of state labels that are to be combined
Source:
Returns:
[q3, q0, q5] -> '{q0,q3,q5}'
Type
string