Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
blockpath.c File Reference
#include <cgraph/list.h>
#include <cgraph/agxbuf.h>
#include <cgraph/alloc.h>
#include <circogen/blockpath.h>
#include <circogen/circular.h>
#include <circogen/edgelist.h>
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for blockpath.c:

Go to the source code of this file.

Macros

#define ORIGE(e)   (ED_to_orig(e))
 
#define CROSS_ITER   10
 

Functions

static Agraph_tclone_graph (Agraph_t *ing, Agraph_t **xg, circ_state *state)
 
static int cmpDegree (const Agnode_t **a, const Agnode_t **b)
 comparison function for sorting nodes by degree, descending
 
static deglist_t getList (Agraph_t *g)
 Add nodes to deg_list, storing them by descending degree.
 
static void find_pair_edges (Agraph_t *g, Agnode_t *n, Agraph_t *outg)
 
static Agraph_tremove_pair_edges (Agraph_t *ing, circ_state *state)
 
static void measure_distance (Agnode_t *n, Agnode_t *ancestor, int dist, Agnode_t *change)
 
static nodelist_t find_longest_path (Agraph_t *tree)
 Find and return longest path in tree.
 
static void dfs (Agraph_t *g, Agnode_t *n, Agraph_t *tree)
 Simple depth first search, adding traversed edges to tree.
 
static Agraph_tspanning_tree (Agraph_t *g)
 Construct spanning forest of g as subgraph.
 
static void block_graph (Agraph_t *g, block_t *sn)
 Add induced edges.
 
static int count_all_crossings (nodelist_t *list, Agraph_t *subg)
 
static nodelist_t reduce (nodelist_t list, Agraph_t *subg, int *cnt)
 
static nodelist_t reduce_edge_crossings (nodelist_t list, Agraph_t *subg)
 
static double largest_nodesize (nodelist_t *list)
 Return max dimension of nodes on list.
 
static void place_node (Agraph_t *g, Agnode_t *n, nodelist_t *list)
 Add n to list. By construction, n is not in list at start.
 
static void place_residual_nodes (Agraph_t *g, nodelist_t *list)
 Add nodes not in list to list.
 
nodelist_t layout_block (Agraph_t *g, block_t *sn, double min_dist, circ_state *state)
 

Macro Definition Documentation

◆ CROSS_ITER

#define CROSS_ITER   10

Definition at line 454 of file blockpath.c.

◆ ORIGE

#define ORIGE (   e)    (ED_to_orig(e))

Definition at line 24 of file blockpath.c.

Function Documentation

◆ block_graph()

static void block_graph ( Agraph_t g,
block_t sn 
)
static

Definition at line 393 of file blockpath.c.

References agfstnode(), agfstout(), aghead, agnxtnode(), agnxtout(), agsubedge(), BLOCK, and block::sub_graph.

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone_graph()

static Agraph_t * clone_graph ( Agraph_t ing,
Agraph_t **  xg,
circ_state state 
)
static

Definition at line 33 of file blockpath.c.

References agbindrec(), agedge(), agfstnode(), agfstout(), aghead, agnameof(), agnode(), agnxtnode(), agnxtout(), agopen(), agsubedge(), agsubg(), agsubnode(), agxbfree(), agxbprint(), agxbuse(), CLONE, DEGREE, Agraph_s::desc, gname, NULL, ORIGE, and state.

Referenced by remove_pair_edges().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmpDegree()

static int cmpDegree ( const Agnode_t **  a,
const Agnode_t **  b 
)
static

Definition at line 75 of file blockpath.c.

References DEGREE.

Referenced by getList(), and remove_pair_edges().

Here is the caller graph for this function:

◆ count_all_crossings()

static int count_all_crossings ( nodelist_t *  list,
Agraph_t subg 
)
static

Definition at line 407 of file blockpath.c.

References add_edge(), agfstedge(), agfstnode(), agfstout(), aghead, agnxtedge(), agnxtnode(), agnxtout(), agtail, dtfirst, dtnext, edgelistitem::edge, EDGEORDER, free_edgelist(), init_edgelist(), and remove_edge().

Referenced by reduce(), and reduce_edge_crossings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfs()

static void dfs ( Agraph_t g,
Agnode_t n,
Agraph_t tree 
)
static

Definition at line 342 of file blockpath.c.

References agfstedge(), aghead, agnxtedge(), agsubedge(), agtail, dfs(), neighbor, SET_VISITED, TPARENT, tree, and VISITED.

Referenced by dfs(), and spanning_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_longest_path()

static nodelist_t find_longest_path ( Agraph_t tree)
static

Definition at line 288 of file blockpath.c.

References agfstedge(), agfstnode(), agnnodes(), agnxtedge(), agnxtnode(), DISTONE, DISTTWO, endPath(), LEAFONE, LEAFTWO, measure_distance(), NULL, reverseAppend(), SET_ONPATH, TPARENT, and tree.

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_pair_edges()

static void find_pair_edges ( Agraph_t g,
Agnode_t n,
Agraph_t outg 
)
static

Definition at line 106 of file blockpath.c.

References agbindrec(), agdelete(), agedge(), agfindedge, agfstedge(), aghead, agnxtedge(), agtail, DEGREE, free(), gv_calloc(), mark(), node_degree, NULL, and ORIGE.

Referenced by remove_pair_edges().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getList()

static deglist_t getList ( Agraph_t g)
static

Definition at line 95 of file blockpath.c.

References agfstnode(), agnxtnode(), and cmpDegree().

Referenced by remove_pair_edges().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ largest_nodesize()

static double largest_nodesize ( nodelist_t *  list)
static

Definition at line 516 of file blockpath.c.

References ND_height, ND_width, and ORIGN.

Referenced by layout_block().

Here is the caller graph for this function:

◆ layout_block()

nodelist_t layout_block ( Agraph_t g,
block_t sn,
double  min_dist,
circ_state state 
)
Parameters
stateContext containing a counter to use for graph copy naming

Definition at line 594 of file blockpath.c.

References agclose(), block_graph(), find_longest_path(), ISPARENT, largest_nodesize(), M_PI, N, ND_pos, block::parent_pos, place_residual_nodes(), POSITION, PSI, block::rad0, block::radius, realignNodelist(), reduce_edge_crossings(), remove_pair_edges(), spanning_tree(), state, block::sub_graph, and tree.

Referenced by doBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ measure_distance()

static void measure_distance ( Agnode_t n,
Agnode_t ancestor,
int  dist,
Agnode_t change 
)
static

Definition at line 250 of file blockpath.c.

References dist(), DISTONE, DISTTWO, LEAFONE, LEAFTWO, measure_distance(), NULL, parent, and TPARENT.

Referenced by find_longest_path(), and measure_distance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ place_node()

static void place_node ( Agraph_t g,
Agnode_t n,
nodelist_t *  list 
)
static

Definition at line 531 of file blockpath.c.

References agfstin(), agfstout(), aghead, agnxtin(), agnxtout(), agtail, appendNodelist(), NEIGHBOR, SET_NEIGHBOR, and UNSET_NEIGHBOR.

Referenced by place_residual_nodes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ place_residual_nodes()

static void place_residual_nodes ( Agraph_t g,
nodelist_t *  list 
)
static

Definition at line 583 of file blockpath.c.

References agfstnode(), agnxtnode(), ONPATH, and place_node().

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce()

static nodelist_t reduce ( nodelist_t  list,
Agraph_t subg,
int *  cnt 
)
static

Definition at line 460 of file blockpath.c.

References agfstedge(), agfstnode(), aghead, agnxtedge(), agnxtnode(), agtail, cnt(), count_all_crossings(), insertNodelist(), and neighbor.

Referenced by reduce_edge_crossings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce_edge_crossings()

static nodelist_t reduce_edge_crossings ( nodelist_t  list,
Agraph_t subg 
)
static

Definition at line 498 of file blockpath.c.

References count_all_crossings(), CROSS_ITER, and reduce().

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_pair_edges()

static Agraph_t * remove_pair_edges ( Agraph_t ing,
circ_state state 
)
static

Create layout skeleton of ing. Why is returned graph connected?

Parameters
stateContext containing a counter to use for graph copy naming

Definition at line 204 of file blockpath.c.

References agclose(), agdelete(), agfstedge(), aghead, agnnodes(), agnxtedge(), agtail, clone_graph(), cmpDegree(), DEGREE, find_pair_edges(), getList(), NULL, and state.

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spanning_tree()

static Agraph_t * spanning_tree ( Agraph_t g)
static

Definition at line 363 of file blockpath.c.

References agbindrec(), agfstnode(), agnxtnode(), agsubg(), agsubnode(), agxbfree(), agxbprint(), agxbuse(), dfs(), DISTONE, DISTTWO, gname, NULL, TPARENT, tree, UNSET_VISITED, and VISITED.

Referenced by layout_block().

Here is the call graph for this function:
Here is the caller graph for this function: