Skip to content
GraphNeighbors

GraphNeighbors

Description

Adjacency list for a single graph node.

Each item is a GraphNodeId referring to another live node. Graph uses this same vector shape for both outgoing and incoming adjacency storage.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    static bool graph_neighbors_contains(const GraphNeighbors *neighbors, GraphNodeId node_id) {
        size idx;
    }
    
    static size graph_find_neighbor_index(const GraphNeighbors *neighbors, GraphNodeId node_id) {
        size idx;
    
    static bool graph_remove_edge_now(GenericGraph *graph, GraphNodeId from, GraphNodeId to) {
        GraphNeighbors *out_neighbors;
        GraphNeighbors *in_neighbors;
        size            out_idx;
    static bool graph_remove_edge_now(GenericGraph *graph, GraphNodeId from, GraphNodeId to) {
        GraphNeighbors *out_neighbors;
        GraphNeighbors *in_neighbors;
        size            out_idx;
        size            in_idx;
    static size graph_remove_marked_outgoing_edges(GenericGraph *graph, GraphNodeId from) {
        size            removed   = 0;
        GraphNeighbors *neighbors = graph_out_neighbors_ptr(graph, from);
        size            idx       = 0;
    static size graph_remove_all_outgoing_edges(GenericGraph *graph, GraphNodeId from) {
        size            removed   = 0;
        GraphNeighbors *neighbors = graph_out_neighbors_ptr(graph, from);
    
        while (neighbors->length) {
        for (free_index_i = 0; free_index_i < graph->pending_edge_removals.length; free_index_i++) {
            const GraphPendingEdgeRemoval *pending = VecPtrAt((GraphPendingEdgeRemovals *)&graph->pending_edge_removals, free_index_i);
            const GraphNeighbors         *neighbors;
    
            graph_validate_node_id(graph, pending->from);
    }
    
    GraphNeighbors *graph_out_neighbors_ptr(GenericGraph *graph, GraphNodeId node_id) {
        return &graph_require_live_slot(graph, node_id)->out_neighbors;
    }
    }
    
    GraphNeighbors *graph_in_neighbors_ptr(GenericGraph *graph, GraphNodeId node_id) {
        return &graph_require_live_slot(graph, node_id)->in_neighbors;
    }
    
    GraphNodeId graph_neighbor_at(GenericGraph *graph, GraphNodeId from, size neighbor_idx) {
        GraphNeighbors *neighbors;
    
        ValidateGraph(graph);
    
    GraphNodeId graph_predecessor_at(GenericGraph *graph, GraphNodeId to, size predecessor_idx) {
        GraphNeighbors *neighbors;
    
        ValidateGraph(graph);
    
    bool graph_has_edge(GenericGraph *graph, GraphNodeId from, GraphNodeId to) {
        GraphNeighbors *neighbors;
    
        ValidateGraph(graph);
    
    bool graph_add_edge(GenericGraph *graph, GraphNodeId from, GraphNodeId to) {
        GraphNeighbors *out_neighbors;
        GraphNeighbors *in_neighbors;
    bool graph_add_edge(GenericGraph *graph, GraphNodeId from, GraphNodeId to) {
        GraphNeighbors *out_neighbors;
        GraphNeighbors *in_neighbors;
    
        ValidateGraph(graph);
    
    bool graph_neighbor_iter_next(GenericGraphNeighborIter *iter, GraphNode *out_node) {
        GraphNeighbors *neighbors;
    
        if (!iter || !out_node) {
    
    bool graph_predecessor_iter_next(GenericGraphPredecessorIter *iter, GraphNode *out_node) {
        GraphNeighbors *neighbors;
    
        if (!iter || !out_node) {
    
    typedef struct {
        GraphNeighbors out_neighbors;
        GraphNeighbors in_neighbors;
        void          *data;
    typedef struct {
        GraphNeighbors out_neighbors;
        GraphNeighbors in_neighbors;
        void          *data;
        u64            visit_count;
Last updated on