⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _g_sort.c

📁 数据类型和算法库LEDA 数据类型和算法库LEDA
💻 C
字号:
/*******************************************************************************
+
+  LEDA  3.0
+
+
+  _g_sort.c
+
+
+  Copyright (c) 1992  by  Max-Planck-Institut fuer Informatik
+  Im Stadtwald, 6600 Saarbruecken, FRG     
+  All rights reserved.
+ 
*******************************************************************************/



#include <LEDA/graph.h>

//--------------------------------------------------------------------------
// sorting
//--------------------------------------------------------------------------

static const graph_array(node)*  NA;
static const graph_array(edge)*  EA;
static const graph* GGG;

static int array_cmp_nodes(node& x, node& y) { return NA->cmp_entry(x,y); }
static int array_cmp_edges(edge& x, edge& y) { return EA->cmp_entry(x,y); }

static int graph_cmp_nodes(node& x, node& y){ return GGG->cmp_node_entry(x,y); }
static int graph_cmp_edges(edge& x, edge& y){ return GGG->cmp_edge_entry(x,y); }


void graph::sort_nodes(cmp_graph_node f) { V.sort(f); }

void graph::sort_edges(cmp_graph_edge f)
{ E.sort(f);
  node v;
  forall(v,V) v->adj_edges.sort(f);
}

void graph::sort_nodes(const graph_array(node)& A) 
{ NA = &A; 
  sort_nodes(array_cmp_nodes); 
 }

void graph::sort_edges(const graph_array(edge)& A) 
{ EA = &A; 
  sort_edges(array_cmp_edges); 
 }


void graph::sort_nodes() 
{ GGG = this; 
  sort_nodes(graph_cmp_nodes); 
 }

void graph::sort_edges() 
{ GGG = this; 
  sort_edges(graph_cmp_edges); 
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -