93using Info_Nodo = std::pair<std::string, DynDlist<std::string>>;
127 words.
append(
text.substr(start, stop - start));
144 return o1.first ==
o2.first;
165 for (
auto it = g.get_node_it(); it.has_curr(); it.next_ne())
167 auto *n = it.get_curr();
168 if (n->get_info().first == s)
213 split(line,
"|", fields);
216 g.insert_node(
Info_Nodo(fields[0], fields));
291 const std::string &
plazo = fields[1];
294 else if (
plazo ==
"mp")
296 else if (
plazo ==
"lp")
302 output <<
"\\n" << fields[6];
305 output <<
"\\nP=" << fields[5];
308 output <<
"\\n" << fields[4] <<
"%";
314 const std::string &
clase = fields[2];
316 output <<
" shape = box ";
317 else if (
clase ==
"ef")
318 output <<
" shape = ellipse ";
319 else if (
clase ==
"pp")
320 output <<
" shape = hexagon ";
330 output <<
"// WARNING: Cycle detected in ";
335 if (
not it.is_in_last())
346 for (
auto it =
ranks.
get_it(); it.has_curr(); it.next_ne())
349 output <<
"{ rank = same; \n";
350 for (
auto ni = level.
get_it();
ni.has_curr();
ni.next_ne())
351 output <<
ni.get_curr()->get_info().first <<
" ";
359 output << g.get_src_node(a)->get_info().first <<
" -> "
360 << g.get_tgt_node(a)->get_info().first <<
"\n";
Tarjan's algorithm for strongly connected components.
Generic directed graph (digraph) wrapper template.
typename BaseGraph::Arc Arc
typename BaseGraph::Node Node
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic doubly linked list with O(1) size and bidirectional access.
const size_t & size() const noexcept
Return the number of elements (constant time)
T & append(const T &item)
Append a copied item at the end of the list.
Dynamic singly linked list with functional programming support.
void next_ne() noexcept
Advances the iterator to the next filtered element (noexcept version).
size_t size() const noexcept
Count the number of elements of the list.
Filtered iterator on the nodes of a graph.
Iterator on nodes and arcs of a path.
size_t length() const noexcept
Count the number of elements of a container.
auto get_it() const
Return a properly initialized iterator positioned at the first item on the container.
bool with_power
Configuration options for DOT file generation.
bool with_class
If true, set node shapes based on class field.
Digrafo::Node * search_node(Digrafo &g, const std::string &s)
Find or create a node by ID.
bool vertical
If true, use vertical layout (default).
void load_digraph(Digrafo &g, std::istream &nodes_input, std::istream &arcs_input)
Load nodes and arcs from streams into the directed graph.
bool only_num
If true, show only the node number, not the full label.
size_t font_size
Font size for the DOT output.
void generate_dot_file(Digrafo &g, std::ostream &output)
Generate a DOT representation of the digraph.
bool with_nes
If true, include NES percentage in node labels.
Main namespace for Aleph-w library functions.
static int search_node(DynArray< typename GT::Node * > &nodes, typename GT::Node *p) noexcept
constexpr size_t MIN_NODE_FIELDS
Minimum expected columns for a node record.
Array< size_t > ranks(const Array< T > &array)
Computes the rank of each element in an Array.
std::pair< std::string, DynDlist< std::string > > Info_Nodo
Node payload: (id, fields) where fields come from the input row.
std::vector< std::string > & split(const std::string &s, const char delim, std::vector< std::string > &elems)
Split a std::string by a single delimiter character.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Filtered iterator on all the arcs of a graph.
Functor to compare nodes by their ID.
bool operator()(const Info_Nodo &o1, const Info_Nodo &o2) const
Compare two node info objects by ID.
Arc of graph implemented with double-linked adjacency lists.
Node belonging to a graph implemented with a double linked adjacency list.
Topological sorting algorithms for directed acyclic graphs (DAGs).
Generic graph and digraph implementations.