1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /* This file is part of nit.
- *
- * Nit is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Nit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with nit. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef GRAPH_H
- #define GRAPH_H
- #include "set.h"
- typedef struct Graph_node {
- void *vertex;
- Set edges; /* Treated as map if named edges */
- } Graph_node;
- typedef struct Graph {
- Disposer nd_dspr;
- Set nodes;
- } Graph;
- /* set map to nonzero for named edges */
- Nit_error
- graph_init(Graph *graph, Disposer *vrtx_dspr, int map);
- void
- graph_dispose(Graph *graph);
- Graph_node *
- graph_node(Graph *graph, void *vertex);
- void *
- graph_denode(Graph *graph, Graph_node *node, int ret_ver);
- /* set key to NULL if not using named edges */
- Nit_error
- graph_join(Graph_node *from, Graph_node *to,
- uint32_t key_len, const void *key);
- void
- graph_disjoin(Graph_node *from, Graph_node *to,
- uint32_t key_len, const void *key);
- /* should only work for named edges */
- Graph_node *
- graph_get(Graph_node *node, uint32_t key_len, const void *key);
- int
- graph_linked(Graph_node *from, Graph_node *to, Set_key *map_key);
- #endif
|