Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
_dfsnum.c
Package: leda.tar.gz [view]
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 2k
Category:
Mathimatics-Numerical algorithms
Development Platform:
MultiPlatform
- /*******************************************************************************
- +
- + LEDA-R 3.2.3
- +
- + _dfsnum.c
- +
- + Copyright (c) 1995 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 66123 Saarbruecken, Germany
- + All rights reserved.
- +
- *******************************************************************************/
- /*******************************************************************************
- * *
- * DFS_NUM (depth first search numbering) *
- * *
- *******************************************************************************/
- #include <LEDA/graph_alg.h>
- static int dfs_count1,dfs_count2;
- static void dfs(node v, node_array<bool>& reached,
- node_array<int>& dfsnum,
- node_array<int>& compnum,
- list<edge>& T )
- { node w;
- edge e;
- reached[v] = true;
- dfsnum[v] = ++dfs_count1;
- forall_adj_edges(e,v)
- { w = target(e);
- if (!reached[w])
- { T.append(e);
- dfs(w,reached,dfsnum,compnum,T);
- }
- }
- compnum[v] = ++dfs_count2;
- }
- list<edge> DFS_NUM(const graph& G, node_array<int>& dfsnum,
- node_array<int>& compnum)
- {
- list<edge> T;
- node_array<bool> reached(G,false);
- node v;
- dfs_count1 = dfs_count2 = 0;
- forall_nodes(v,G) if (!reached[v]) dfs(v,reached,dfsnum,compnum,T);
- return T;
- }