00001 /* 00002 * Copyright 2008, 2009 Alexandros Frantzis, Michael Iatrou 00003 * 00004 * This file is part of libbls. 00005 * 00006 * libbls is free software: you can redistribute it and/or modify it under the 00007 * terms of the GNU Lesser General Public License as published by the Free Software 00008 * Foundation, either version 3 of the License, or (at your option) any later 00009 * version. 00010 * 00011 * libbls is distributed in the hope that it will be useful, but WITHOUT ANY 00012 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00014 * details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with 00017 * libbls. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 /** 00021 * @file overlap_graph.h 00022 * 00023 * Overlap graph API 00024 */ 00025 #ifndef _BLESS_OVERLAP_GRAPH_H 00026 #define _BLESS_OVERLAP_GRAPH_H 00027 00028 #include "segment.h" 00029 #include "list.h" 00030 #include <sys/types.h> 00031 00032 /** 00033 * @defgroup overlap_graph Overlap Graph 00034 * 00035 * Graph showing the overlap of segments. 00036 * 00037 * See doc/devel/buffer_save.txt for more information. 00038 * 00039 * @{ 00040 */ 00041 00042 /** 00043 * Opaque type for overlap graph. 00044 */ 00045 typedef struct overlap_graph overlap_graph_t; 00046 00047 /** 00048 * List entry for edges 00049 */ 00050 struct edge_entry { 00051 struct list_node ln; 00052 segment_t *src; 00053 segment_t *dst; 00054 off_t dst_mapping; 00055 off_t weight; 00056 }; 00057 00058 /** 00059 * List entry for segments 00060 */ 00061 struct vertex_entry { 00062 struct list_node ln; 00063 segment_t *segment; 00064 off_t mapping; 00065 off_t self_loop_weight; 00066 }; 00067 00068 int overlap_graph_new(overlap_graph_t **g, size_t capacity); 00069 00070 int overlap_graph_free(overlap_graph_t *g); 00071 00072 int overlap_graph_add_segment(overlap_graph_t *g, segment_t *seg, off_t mapping); 00073 00074 int overlap_graph_remove_cycles(overlap_graph_t *g); 00075 00076 int overlap_graph_get_removed_edges(overlap_graph_t *g, list_t **edges); 00077 00078 int overlap_graph_get_vertices_topo(overlap_graph_t *g, list_t **vertices); 00079 00080 int overlap_graph_export_dot(overlap_graph_t *g, int fd); 00081 00082 /** @} */ 00083 00084 #endif