#include "platform.h"
#include "regex_internal_lib.h"
#include "regex_test_lib.h"
#include "regex_internal.h"
Go to the source code of this file.
Data Structures | |
struct | REGEX_TEST_Graph_Context |
Context for graph creation. More... | |
Functions | |
static void | scc_tarjan_strongconnect (unsigned int *scc_counter, struct REGEX_INTERNAL_State *v, unsigned int *index, struct REGEX_INTERNAL_State **stack, unsigned int *stack_size) |
Recursive function doing DFS with 'v' as a start, detecting all SCCs inside the subgraph reachable from 'v'. More... | |
static void | scc_tarjan (struct REGEX_INTERNAL_Automaton *a) |
Detect all SCCs (Strongly Connected Components) inside the given automaton. More... | |
static void | automaton_save_graph_step (void *cls, unsigned int count, struct REGEX_INTERNAL_State *s) |
Save a state to an open file pointer. More... | |
void | REGEX_TEST_automaton_save_graph (struct REGEX_INTERNAL_Automaton *a, const char *filename, enum REGEX_TEST_GraphSavingOptions options) |
Save the given automaton as a GraphViz dot file. More... | |
|
static |
Recursive function doing DFS with 'v' as a start, detecting all SCCs inside the subgraph reachable from 'v'.
Used with scc_tarjan function to detect all SCCs inside an automaton.
scc_counter | counter for numbering the sccs |
v | start vertex |
index | current index |
stack | stack for saving all SCCs |
stack_size | current size of the stack |
Definition at line 66 of file regex_test_graph.c.
References REGEX_INTERNAL_State::contained, REGEX_INTERNAL_State::index, REGEX_INTERNAL_State::lowlink, GNUNET_SCHEDULER_Task::next, REGEX_INTERNAL_State::scc_id, scc_tarjan_strongconnect(), t, and REGEX_INTERNAL_State::transitions_head.
Referenced by scc_tarjan(), and scc_tarjan_strongconnect().
|
static |
Detect all SCCs (Strongly Connected Components) inside the given automaton.
SCCs will be marked using the scc_id on each state.
a | the automaton for which SCCs should be computed and assigned. |
Definition at line 117 of file regex_test_graph.c.
References REGEX_INTERNAL_State::contained, REGEX_INTERNAL_State::index, REGEX_INTERNAL_State::lowlink, REGEX_INTERNAL_State::next, scc_tarjan_strongconnect(), REGEX_INTERNAL_Automaton::state_count, and REGEX_INTERNAL_Automaton::states_head.
Referenced by REGEX_TEST_automaton_save_graph().
|
static |
Save a state to an open file pointer.
cls is expected to be a file pointer to an open file. Used only in conjunction with REGEX_TEST_automaton_save_graph.
cls | file pointer. |
count | current count of the state, not used. |
s | state. |
Definition at line 154 of file regex_test_graph.c.
References REGEX_INTERNAL_State::accepting, ctx, REGEX_INTERNAL_State::dfs_id, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_YES, REGEX_INTERNAL_State::hash, REGEX_INTERNAL_State::id, REGEX_INTERNAL_Transition::label, name, REGEX_INTERNAL_State::name, REGEX_INTERNAL_Transition::next, REGEX_INTERNAL_State::proof, REGEX_INTERNAL_State::scc_id, REGEX_INTERNAL_Transition::to_state, and REGEX_INTERNAL_State::transitions_head.
Referenced by REGEX_TEST_automaton_save_graph().
void REGEX_TEST_automaton_save_graph | ( | struct REGEX_INTERNAL_Automaton * | a, |
const char * | filename, | ||
enum REGEX_TEST_GraphSavingOptions | options | ||
) |
Save the given automaton as a GraphViz dot file.
a | the automaton to be saved. |
filename | where to save the file. |
options | options for graph generation that include coloring or verbose mode |
Definition at line 270 of file regex_test_graph.c.
References automaton_save_graph_step(), ctx, end, filename, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_YES, options, REGEX_INTERNAL_automaton_traverse(), REGEX_TEST_GRAPH_COLORING, REGEX_TEST_GRAPH_VERBOSE, scc_tarjan(), start, and REGEX_INTERNAL_Automaton::start.