I am looking at the three enum types starting here:
#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
__BEGIN_DECLS
/* -------------------------------------------------- */
/* Constants */
/* -------------------------------------------------- */
typedef enum { IGRAPH_UNDIRECTED = 0, IGRAPH_DIRECTED = 1 } igraph_i_directed_t;
typedef enum { IGRAPH_NO_LOOPS = 0, IGRAPH_LOOPS = 1 } igraph_i_loops_t;
typedef enum { IGRAPH_NO_MULTIPLE = 0, IGRAPH_MULTIPLE = 1 } igraph_i_multiple_t;
typedef enum { IGRAPH_ASCENDING = 0, IGRAPH_DESCENDING = 1 } igraph_order_t;
typedef enum { IGRAPH_MINIMUM = 0, IGRAPH_MAXIMUM = 1 } igraph_optimal_t;
typedef enum { IGRAPH_OUT = 1, IGRAPH_IN = 2, IGRAPH_ALL = 3,
typedef enum { IGRAPH_UNDIRECTED = 0, IGRAPH_DIRECTED = 1 } igraph_i_directed_t;
typedef enum { IGRAPH_NO_LOOPS = 0, IGRAPH_LOOPS = 1 } igraph_i_loops_t;
typedef enum { IGRAPH_NO_MULTIPLE = 0, IGRAPH_MULTIPLE = 1 } igraph_i_multiple_t;
These do not appear to be used anywhere.
It appears that their purpose is to make code more readable in contexts where a Boolean value is required. Instead of writing /* directed= */ 1
for a function argument, one may write IGRAPH_DIRECTED
, which is not a Boolean value, but presumably it is intended to be used as one.
@tamas and @Gabor , can you confirm that this was the intention behind these enums?
tamas
8 July 2020 15:50
2
Yes, as far as I remember their purpose was (is) to improve readability in boolean contexts.