/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2021 MediaTek Inc.
 */

#ifndef MTK_DMX_GRAPH_H
#define MTK_DMX_GRAPH_H

#include <linux/types.h> //bool

struct graph_node;

struct graph {
	// An array of pointers to node to represent an adjacency list
	struct graph_node **head;
	int max_count;
};

struct graph_node {
	int dest;
	struct graph_node *next;
};

struct edge {
	int src;
	int dest;
};

struct edges {
	int max_count;
	int valid_count;
	struct edge *edge;
};

struct graph_context;

typedef const char *(*node_type_2_str)(int);
typedef bool (*edges_prepare)(
		struct graph_context,
		struct edges *);

struct graph_context {
	int vertex_max_count;
	int edge_max_count;

	node_type_2_str pfNodeType2Str;
	edges_prepare pfEdgesPrepare;

	void *priv;
};

u64 mtk_dmx_graph_permutation(int n, int r);
u64 mtk_dmx_graph_combination(int n, int r);

void mtk_dmx_graph_print(struct graph_context stGraphContext);

#endif /* MTK_DMX_GRAPH_H */
