Graphviz 13.1.3~dev.20250829.0113
|
Network Simplex algorithm for ranking nodes of a DAG, rank, rank2. More...
#include <assert.h>
#include <common/render.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <util/alloc.h>
#include <util/exit.h>
#include <util/gv_math.h>
#include <util/list.h>
#include <util/overflow.h>
#include <util/prisize_t.h>
#include <util/streq.h>
Go to the source code of this file.
Data Structures | |
struct | network_simplex_ctx_t |
struct | subtree_s |
struct | tst_t |
state for use in tight_subtree_search More... | |
struct | STheap_s |
struct | dfs_state_t |
local state used by dfs_range* More... | |
Macros | |
#define | LENGTH(e) (ND_rank(aghead(e)) - ND_rank(agtail(e))) |
#define | SLACK(e) (LENGTH(e) - ED_minlen(e)) |
#define | SEQ(a, b, c) ((a) <= (b) && (b) <= (c)) |
#define | TREE_EDGE(e) (ED_tree_index(e) >= 0) |
#define | ND_subtree(n) (subtree_t*)ND_par(n) |
#define | ND_subtree_set(n, value) (ND_par(n) = (edge_t*)value) |
Typedefs | |
typedef struct subtree_s | subtree_t |
typedef struct STheap_s | STheap_t |
Enumerations | |
enum | { SEARCHSIZE = 30 } |
#define TREE_EDGE | ( | e | ) | (ED_tree_index(e) >= 0) |
|
static |
Definition at line 55 of file ns.c.
References agerrorf(), aghead, agtail, ED_tree_index, LIST_APPEND, LIST_SIZE, ND_in, ND_mark, ND_out, ND_tree_in, ND_tree_out, NULL, and TREE_EDGE.
Referenced by merge_trees(), and tight_subtree_search().
|
static |
Definition at line 753 of file ns.c.
References ND_rank.
Referenced by increasingrankcmpf(), and TB_balance().
Definition at line 1067 of file ns.c.
References aghead, agtail, dfs_cutval(), ND_tree_in, ND_tree_out, and x_cutval().
Referenced by dfs_cutval(), and init_cutvalues().
Definition at line 246 of file ns.c.
References aghead, agtail, LIST, LIST_APPEND, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, Low, ND_in, ND_lim, ND_tree_out, NULL, SEQ, SLACK, and TREE_EDGE.
Referenced by enter_edge().
Definition at line 213 of file ns.c.
References aghead, agtail, LIST, LIST_APPEND, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, Low, ND_lim, ND_out, ND_tree_in, NULL, SEQ, SLACK, and TREE_EDGE.
Referenced by enter_edge().
Definition at line 1162 of file ns.c.
References aghead, agtail, LIST, LIST_BACK, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, LIST_PUSH_BACK, ND_lim, ND_low, ND_par, ND_tree_in, ND_tree_out, and dfs_state_t::v.
Referenced by update().
|
static |
Definition at line 1096 of file ns.c.
References aghead, agtail, LIST, LIST_BACK, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, LIST_PUSH_BACK, ND_lim, ND_low, ND_par, ND_tree_in, ND_tree_out, NULL, and dfs_state_t::v.
Referenced by init_cutvalues().
Definition at line 280 of file ns.c.
References aghead, agtail, dfs_enter_inedge(), dfs_enter_outedge(), ND_lim, and ND_low.
Referenced by LR_balance(), and rank2().
|
static |
Definition at line 112 of file ns.c.
References aghead, agtail, ED_tree_index, LIST_SET, ND_tree_in, ND_tree_out, and NULL.
Referenced by update().
|
static |
Definition at line 578 of file ns.c.
References error, find_tight_subtree(), free(), network_simplex_ctx_t::G, GD_nlist, gv_calloc(), subtree_s::heap_index, init_cutvalues(), inter_tree_edge(), LIST_SIZE, merge_trees(), ND_next, ND_subtree, ND_subtree_set, NULL, STbuildheap(), STextractmin(), STheapify(), STheapsize(), and tree.
Referenced by rank2().
|
static |
Definition at line 402 of file ns.c.
References free(), gv_alloc(), NULL, subtree_s::par, subtree_s::rep, subtree_s::size, and tight_subtree_search().
Referenced by feasible_tree().
|
static |
Definition at line 723 of file ns.c.
References free_list, GD_nlist, ND_mark, ND_next, ND_tree_in, ND_tree_out, and reset_lists().
Referenced by LR_balance(), and rank2().
|
static |
|
static |
Definition at line 765 of file ns.c.
References decreasingrankcmpf().
Referenced by TB_balance().
|
static |
Definition at line 297 of file ns.c.
References dfs_cutval(), dfs_range_init(), network_simplex_ctx_t::G, GD_nlist, and NULL.
Referenced by feasible_tree().
|
static |
Definition at line 845 of file ns.c.
References aghead, agtail, ED_cutvalue, ED_minlen, ED_tree_index, network_simplex_ctx_t::G, GD_nlist, gv_calloc(), LIST_RESERVE, ND_in, ND_mark, ND_next, ND_out, ND_priority, ND_rank, ND_tree_in, and ND_tree_out.
Referenced by rank2().
|
static |
Definition at line 144 of file ns.c.
References agerr(), agerrorf(), aghead, agnameof(), AGPREV, agtail, ED_minlen, network_simplex_ctx_t::G, GD_nlist, LIST, LIST_FREE, LIST_IS_EMPTY, LIST_POP_FRONT, LIST_PUSH_BACK, LIST_RESERVE, MAX, ND_in, ND_next, ND_out, ND_priority, and ND_rank.
Referenced by rank2().
Definition at line 482 of file ns.c.
References inter_tree_edge_search(), NULL, and tree.
Referenced by feasible_tree().
Definition at line 450 of file ns.c.
References aghead, agtail, inter_tree_edge_search(), ND_in, ND_out, SLACK, STsetFind(), and TREE_EDGE.
Referenced by inter_tree_edge(), and inter_tree_edge_search().
Invalidate DFS attributes by walking up the tree from to_node till lca (inclusively). Called when updating tree to improve pruning in dfs_range(). Assigns ND_low(n) = -1 for the affected nodes.
Definition at line 88 of file ns.c.
References agerrorf(), aghead, agtail, ND_lim, ND_low, ND_par, and NULL.
Referenced by update().
|
static |
|
static |
Definition at line 733 of file ns.c.
References aghead, agtail, delta, ED_cutvalue, enter_edge(), freeTreeList(), network_simplex_ctx_t::G, LIST_GET, LIST_SIZE, ND_lim, NULL, rerank(), and SLACK.
Referenced by rank2().
|
static |
Definition at line 549 of file ns.c.
References add_tree_edge(), aghead, agtail, delta, NULL, on_heap(), subtree_s::rep, SLACK, STsetFind(), STsetUnion(), tree_adjust(), and TREE_EDGE.
Referenced by feasible_tree().
|
static |
Definition at line 316 of file ns.c.
References subtree_s::heap_index, SIZE_MAX, and tree.
Referenced by merge_trees(), resolveColor(), and STsetUnion().
int rank | ( | graph_t * | g, |
int | balance, | ||
int | maxiter | ||
) |
Definition at line 986 of file ns.c.
References agget(), rank2(), and SEARCHSIZE.
Referenced by adjustRanks(), adjustSimple(), checkFlatAdjacent(), clust_ht(), constrainX(), constrainY(), dot_position(), flat_limits(), make_LR_constraints(), neighbor(), rank1(), set_xcoords(), and set_ycoords().
int rank2 | ( | graph_t * | g, |
int | balance, | ||
int | maxiter, | ||
int | search_size | ||
) |
Definition at line 908 of file ns.c.
References elapsed_sec(), enter_edge(), err, feasible_tree(), freeTreeList(), network_simplex_ctx_t::G, graphSize(), init_graph(), init_rank(), leave_edge(), LR_balance(), PRISIZE_T, reset_lists(), scan_and_normalize(), SEARCHSIZE, start_timer(), TB_balance(), update(), and Verbose.
Referenced by dot2_rank(), and rank().
|
static |
Definition at line 646 of file ns.c.
References aghead, agtail, delta, ND_par, ND_rank, ND_tree_in, ND_tree_out, and rerank().
Referenced by LR_balance(), rerank(), and update().
|
static |
Definition at line 718 of file ns.c.
References LIST_FREE.
Referenced by freeTreeList(), and rank2().
|
static |
Definition at line 703 of file ns.c.
References network_simplex_ctx_t::G, GD_nlist, MAX, MIN, ND_next, ND_node_type, ND_rank, and NORMAL.
Referenced by rank2(), and TB_balance().
Definition at line 507 of file ns.c.
References gv_alloc(), SIZE_MAX, and STheapify().
Referenced by feasible_tree().
Definition at line 518 of file ns.c.
References subtree_s::heap_index, SIZE_MAX, and STheapify().
Referenced by feasible_tree().
|
static |
Definition at line 489 of file ns.c.
References subtree_s::heap_index, left, right, and SWAP.
Referenced by feasible_tree(), STbuildheap(), and STextractmin().
|
static |
Definition at line 487 of file ns.c.
Referenced by feasible_tree().
Definition at line 420 of file ns.c.
References ND_subtree, and subtree_s::par.
Referenced by inter_tree_edge_search(), and merge_trees().
Definition at line 430 of file ns.c.
References on_heap(), subtree_s::par, s1(), and subtree_s::size.
Referenced by merge_trees().
|
static |
Definition at line 769 of file ns.c.
References agget(), aghead, agtail, decreasingrankcmpf(), ED_minlen, ED_weight, free(), free_list, network_simplex_ctx_t::G, GD_nlist, gv_calloc(), increasingrankcmpf(), LIST, LIST_APPEND, LIST_FREE, LIST_GET, LIST_RESERVE, LIST_SIZE, LIST_SORT, MAX, MIN, ND_in, ND_mark, ND_next, ND_node_type, ND_out, ND_rank, ND_tree_in, ND_tree_out, NORMAL, scan_and_normalize(), and streq().
Referenced by rank2().
|
static |
Definition at line 329 of file ns.c.
References add_tree_edge(), aghead, agtail, last, LIST, LIST_BACK, LIST_FREE, LIST_IS_EMPTY, LIST_POP_BACK, LIST_PUSH_BACK, ND_in, ND_out, ND_subtree, ND_subtree_set, SLACK, top(), TREE_EDGE, and tst_t::v.
Referenced by find_tight_subtree().
Definition at line 532 of file ns.c.
References aghead, agtail, delta, ND_rank, ND_tree_in, ND_tree_out, and tree_adjust().
Referenced by merge_trees(), and tree_adjust().
|
static |
Definition at line 663 of file ns.c.
References agerrorf(), aghead, agtail, delta, dfs_range(), ED_cutvalue, exchange_tree_edges(), invalidate_path(), ND_lim, ND_low, ND_par, ND_tree_in, ND_tree_out, rerank(), SLACK, and treeupdate().
Referenced by rank2().
|
static |
Definition at line 1000 of file ns.c.
References agerrorf(), aghead, agtail, ED_cutvalue, graphviz_exit(), ND_in, ND_out, ND_par, sadd_overflow(), and x_val().
Referenced by dfs_cutval().