Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
topological_sort.h
Go to the documentation of this file.
1/*
2 This file is part of Ansel,
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18
76#include <glib.h>
77
78G_BEGIN_DECLS
79
84
104
119{
120 const char *id;
121 char *tag;
122 GList *previous;
123 void *user_data;
124};
125
134typedef void (*dt_node_user_data_destroy_t)(void *data);
135
167int flatten_nodes(GList *input_nodes, GList **out_nodes);
168
197int topological_sort(GList *nodes, GList **sorted, GList **cycle_out);
198
228 GList *nodes,
229 GHashTable *node_ht,
230 dt_node_user_data_destroy_t user_destroy);
231
241
242G_END_DECLS
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
One constraint set relative to the node that owns it.
Definition topological_sort.h:100
dt_digraph_node_t * next
Definition topological_sort.h:102
dt_digraph_node_t * previous
Definition topological_sort.h:101
Directed graph node.
Definition topological_sort.h:119
char * tag
Definition topological_sort.h:121
const char * id
Definition topological_sort.h:120
void * user_data
Definition topological_sort.h:123
GList * previous
Definition topological_sort.h:122
void dt_digraph_cleanup_full(GList *nodes, GHashTable *node_ht, dt_node_user_data_destroy_t user_destroy)
Free a canonical graph (nodes, constraints, ids) in one call.
Definition topological_sort.c:454
void(* dt_node_user_data_destroy_t)(void *data)
Optional destructor for node payloads.
Definition topological_sort.h:134
int flatten_nodes(GList *input_nodes, GList **out_nodes)
Canonicalize / merge duplicated nodes by id.
Definition topological_sort.c:52
dt_digraph_node_t * dt_digraph_node_new(const char *id)
Allocate and initialize a new digraph node with the given id.
Definition topological_sort.c:41
int topological_sort(GList *nodes, GList **sorted, GList **cycle_out)
Perform a topological sort using depth-first search (DFS).
Definition topological_sort.c:257