_spanning.c
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- /*******************************************************************************
- +
- + LEDA-R 3.2.3
- +
- + _spanning.c
- +
- + Copyright (c) 1995 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 66123 Saarbruecken, Germany
- + All rights reserved.
- +
- *******************************************************************************/
- /*******************************************************************************
- * *
- * SPANNING_TREE (spanning tree) *
- * *
- *******************************************************************************/
- #include <LEDA/graph_alg.h>
- #include <LEDA/node_partition.h>
- list<edge> SPANNING_TREE(const graph& G)
- { node v,w;
- edge e;
- list<edge> EL;
- node_partition P(G);
- forall_edges(e,G)
- { v = source(e);
- w = target(e);
- if (! P.same_block(v,w))
- { EL.append(e);
- P.union_blocks(v,w);
- }
- }
- return EL;
- }