Graphviz 12.0.1~dev.20240715.2254
|
#include <assert.h>
#include <cgraph/alloc.h>
#include <cgraph/cghdr.h>
#include <cgraph/node_set.h>
#include <cgraph/unreachable.h>
#include <stdbool.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | graphviz_node_set |
Variables | |
Dtdisc_t | Ag_subnode_seq_disc |
static Agsubnode_t *const | TOMBSTONE = (Agsubnode_t *)-1 |
a sentinel, marking a set slot from which an element has been deleted | |
Definition at line 179 of file node.c.
References agdeledgeimage(), agfstedge(), agnxtedge(), Agnode_s::base, dtdelete, Agtag_s::id, Agraph_s::n_id, Agraph_s::n_seq, Agsubnode_s::node, node_set_remove(), and Agobj_s::tag.
Referenced by agdelnode().
Definition at line 22 of file node.c.
References Agraph_s::n_id, Agsubnode_s::node, node_set_find(), and NULL.
Referenced by agdelnode(), agfindnode_by_name(), agidnode(), agnode(), agrelabel_node(), and agsubnode().
Definition at line 30 of file node.c.
References agfindnode_by_id(), agmapnametoid(), AGNODE, id, and NULL.
Referenced by agrelabel_node().
Definition at line 327 of file node.c.
References dtfinger, dtrenew(), and Agraph_s::n_seq.
Referenced by agnodebefore().
Definition at line 319 of file node.c.
References dtsearch, Agraph_s::n_seq, and Agsubnode_s::node.
Referenced by agnodebefore().
|
static |
compare a subnode to an identifier for equality
sn0 | Operand 1 |
sn1 | Operand 2 |
Definition at line 286 of file node.c.
References AGID, id, and Agsubnode_s::node.
Referenced by node_set_find(), and node_set_remove().
|
static |
Definition at line 290 of file node.c.
References AGSEQ, and Agsubnode_s::node.
Definition at line 222 of file node.c.
References AGID, agraphof(), agsubrep(), key, Agraph_s::n_id, node_set_add(), node_set_remove(), and NULL.
Referenced by agrelabel_node().
|
static |
Definition at line 307 of file node.c.
References agfree(), AGSNMAIN, Agsubnode_s::node, and Agnode_s::root.
Definition at line 116 of file node.c.
References agmethod_init(), agnodeattr_init(), and agroot().
Referenced by agidnode(), and agnode().
Definition at line 91 of file node.c.
References agalloc(), agroot(), dtinsert, dtsize(), Agnode_s::mainsub, Agraph_s::n_id, Agraph_s::n_seq, Agsubnode_s::node, node_set_add(), and node_set_size().
Referenced by agsubnode(), and installnodetoroot().
Definition at line 108 of file node.c.
References agparent(), installnode(), and installnodetoroot().
Referenced by agidnode(), agnode(), and installnodetoroot().
Definition at line 72 of file node.c.
References agalloc(), agbindrec(), AgDataRecName, AGID, AGNODE, agroot(), AGSEQ, AGTYPE, id, Agnode_s::root, and SEQ_MASK.
Referenced by agidnode(), agnode(), and RTreeInsert().
void node_set_add | ( | node_set_t * | self, |
Agsubnode_t * | item | ||
) |
add an item to the set
If the backing store is not large enough, it is expanded on demand. On allocation failure, exit
is called.
self | Set to add to |
item | Element to add |
Definition at line 412 of file node.c.
References graphviz_node_set::capacity, free(), gv_calloc(), node_set_add(), node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, TOMBSTONE, and UNREACHABLE.
Referenced by dict_relabel(), installnode(), and node_set_add().
Agsubnode_t * node_set_find | ( | node_set_t * | self, |
IDTYPE | key | ||
) |
lookup an existing item in a set
self | Set to search |
key | Identifier of node to look for |
NULL
if it was not in the set Definition at line 475 of file node.c.
References agsubnodeideq(), graphviz_node_set::capacity, key, node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, and TOMBSTONE.
Referenced by agfindnode_by_id(), and agsubrep().
void node_set_free | ( | node_set_t ** | self | ) |
|
static |
compute initial index to attempt to store/find an item in
This function only returns the first index to be examined. node_set_t
is implemented using linear probing, so steps sequentially through indices following this.
If the suboptimal choice of using the ID here turns out to be bad for performance, this could be converted to a more sophisticated hashing algorithm. None of the callers depend on the exact implementation.
self | Set to compute with respect to |
item | Element being sought/added |
Definition at line 406 of file node.c.
References graphviz_node_set::capacity, and NULL.
Referenced by node_set_add(), node_set_find(), and node_set_remove().
node_set_t * node_set_new | ( | void | ) |
construct a new set
Calls exit
on failure (out-of-memory).
Definition at line 391 of file node.c.
References gv_alloc().
Referenced by agopen1().
void node_set_remove | ( | node_set_t * | self, |
IDTYPE | item | ||
) |
remove an item from a set
If the given item was not in the set, this is a no-op.
self | Set to remove from |
item | Identifier of element to remove |
Definition at line 507 of file node.c.
References agsubnodeideq(), graphviz_node_set::capacity, node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, and TOMBSTONE.
Referenced by agdelnodeimage(), and dict_relabel().
size_t node_set_size | ( | const node_set_t * | self | ) |
get the number of items in a set
self | Set to query |
Definition at line 540 of file node.c.
References NULL, and graphviz_node_set::size.
Referenced by agnnodes(), installnode(), and node_set_is_empty().
Dtdisc_t Ag_subnode_seq_disc |
Definition at line 313 of file node.c.
Referenced by agopen1().
|
static |
Definition at line 389 of file node.c.
Referenced by node_set_add(), node_set_find(), and node_set_remove().