PandA-2024.02
Macros | Functions
bfs.c File Reference
#include "bfs.h"
Include dependency graph for bfs.c:

Go to the source code of this file.

Macros

#define Q_PUSH(node)   { queue[q_in==0?N_NODES-1:q_in-1]=node; q_in=(q_in+1)%N_NODES; }
 
#define Q_PEEK()   (queue[q_out])
 
#define Q_POP()   { q_out = (q_out+1)%N_NODES; }
 
#define Q_EMPTY()   (q_in>q_out ? q_in==q_out+1 : (q_in==0)&&(q_out==N_NODES-1))
 

Functions

void bfs (node_t nodes[N_NODES], edge_t edges[N_EDGES], node_index_t starting_node, level_t level[N_NODES], edge_index_t level_counts[N_LEVELS])
 

Macro Definition Documentation

◆ Q_EMPTY

#define Q_EMPTY ( )    (q_in>q_out ? q_in==q_out+1 : (q_in==0)&&(q_out==N_NODES-1))

Definition at line 11 of file bfs.c.

Referenced by bfs().

◆ Q_PEEK

#define Q_PEEK ( )    (queue[q_out])

Definition at line 9 of file bfs.c.

Referenced by bfs().

◆ Q_POP

#define Q_POP ( )    { q_out = (q_out+1)%N_NODES; }

Definition at line 10 of file bfs.c.

Referenced by bfs().

◆ Q_PUSH

#define Q_PUSH (   node)    { queue[q_in==0?N_NODES-1:q_in-1]=node; q_in=(q_in+1)%N_NODES; }

Definition at line 8 of file bfs.c.

Referenced by bfs().

Function Documentation

◆ bfs()

void bfs ( node_t  nodes[N_NODES],
edge_t  edges[N_EDGES],
node_index_t  starting_node,
level_t  level[N_NODES],
edge_index_t  level_counts[N_LEVELS] 
)

Definition at line 13 of file bfs.c.

References edges, level, MAX_LEVEL, N_LEVELS, N_NODES, nodes, Q_EMPTY, Q_PEEK, Q_POP, and Q_PUSH.


Generated on Mon Feb 12 2024 13:03:10 for PandA-2024.02 by doxygen 1.8.13