Algorithmic aspects of linear k-arboricity
状态压缩

状态压缩Abstract信息学发展势头迅猛,信息学奥赛的题目来源遍及各行各业,经常有一些在实际应用中很有价值的问题被引入信息学并得到有效解决。
然而有一些问题却被认为很可能不存在有效的(多项式级的)算法,本文以对几个例题的剖析,简述状态压缩思想及其应用。
Keywords状态压缩、集合、Hash、NPCContentIntroducti o n作为OIers,我们不同程度地知道各式各样的算法。
这些算法有的以O(logn)的复杂度运行,如二分查找、欧几里德GCD算法(连续两次迭代后的余数至多为原数的一半)、平衡树,有的以O(n)运行,例如二级索引、块状链表,再往上有O(n)、O(n p log q n)……大部分问题的算法都有一个多项式级别的时间复杂度上界1,我们一般称这类问题2为P类(deterministic Polynomial-time)问题,例如在有向图中求最短路径。
然而存在几类问题,至今仍未被很好地解决,人们怀疑他们根本没有多项式时间复杂度的算法,它们是NPC(NP-Complete)和NPH(NP-Hard)类,例如问一个图是否存在哈密顿圈(NPC)、问一个图是否不存在哈密顿圈(NPH)、求一个完全图中最短的哈密顿圈(即经典的Traveling Salesman Problem货郎担问题,NPH)、在有向图中求最长(简单)路径(NPH),对这些问题尚不知有多项式时间的算法存在。
P和NPC都是NP(Non-deterministic Polynomial-time)的子集,NPC则代表了NP类中最难的一类问题,所有的NP类问题都可以在多项式时间内归约到NPC问题中去。
NPH包含了NPC和其他一些不属于NP(也更难)的问题(即NPC是NP与NPH的交集),NPC问题的最优化版本一般是NPH的,例如问一个图是否存在哈密顿圈是NPC的,但求最短的哈密顿圈则是NPH的,原因在于我们可以在多项式时间内验证一个回路是否真的是哈密顿回路,却无法在多项式时间内验证其是否是最短的,NP类要求能在多项式时间内验证问题的一个解是否真的是一个解,所以最优化TSP问题不是NP的,而是NPH的。
清华大学 凸优化 讲义ch5_924402893

A B
障 碍 物
D
C
A B
障 碍 物
D
C
五道口最有人气的论坛
/bbs
STEP
n 城 市 的 TSP 问 题 , N={1,2,…,n},A={(i,j)|i,j∈N},城市间的距 离 D = ( d ij ) n×n ,为 TSP 图中的每一条弧(i,j)赋 0 信息素痕迹初值 τ ij (0) = 1
五道口最好的生活网
*
五道口最有人气的论坛
/bbs
定理 GBAS(graph-based ant system)的马尔可夫过 程 X k = (τ ( k ), W ( k )), k = 0,1, L 依 概 率 1 收 敛 到
X * = (τ * , W * ) ,其中 W * 为一条最优路径, τ * 定义如
其中, τ (k ) 为信息素痕迹,在 R 中取值; W (k ) 为 n
|A|
城市的一个排列,最多有 n! 个状态。
定义 一个马尔可夫过程 { X k , k = 0,1, L} ,对任给的 ε > 0 满足
lim Pr X k − X * < ε = 1 ,
k →∞
{
}
则称马尔可夫过程 X k 依概率 1 收敛到 X 。
结束一个循环。如果再对蚁群循环一次,因为W2为全局最优 解,由STEP3的信息素痕迹更新规则,无论四只蚂蚁行走的路 线如何,STEP3 的信息更新为
⎡ 0 1 48 5 24 1 48⎤ ⎢5 24 0 1 48 1 48⎥ ⎥ τ (2) = (τ ij (2) ) = ⎢ ⎢ 1 48 1 48 0 5 24⎥ ⎢ ⎥ 1 48 5 24 1 48 0⎦ ⎣
当前最优解(实际为全局最优解)为W2,STEP3 的信息更新为
基于摘要图的不确定社会网络Top-k子图查询算法

s n d t e r s n o iln t o k n n o e t e if r t n o r i a g a h .T e T p k s b r p i e or p e e ts ca ew r sa d e c d h o ma i fo g n l r p s h o - u g a h g n o i
2. c o lo mp t rS i n e a d Te h o o y,Na tn i e st S h o fCo u e ce c n c n lg no g Un v riy,Na tn 26 9,Ch n n o g 2 01 i a;
3 S ho o C mp t c ne u a nvr t, h n hi 0 4 3 hn ) . c ol f o ue Si c ,F d nU i s y S a g a 2 0 3 ,C ia r e ei
第3 4卷 第 6期 21 0 0年 1 2月
南 京理 工大 学学报 ( 自然 科 学版 )
J un l f a j g U i r t o S i c n eh o g N trl c n e o ra o N ni nv s y f c n ea d T c n l y( aua S i c ) n e i e o e
中图分类 号 :P3 1 T 1
文章 编号 :0 5— 8 0 2 1 )6— 7 8— 6 10 9 3 ( 0 0 0 0 3 0
T p k S b r p eyA g rtm n U cran S ca o - u g a h Qu r lo i h o n eti o il
Vo . 4 1 3 No 6 .
De . 2 0 e 01
《数据结构》期末考试试题及答案

贵州大学理学院数学系信息与计算科学专业《数据结构》期末考试试题及答案(2003-2004学年第2学期)一、单项选择题1.对于一个算法,当输入非法数据时,也要能作出相应的处理,这种要求称为()。
(A)、正确性(B). 可行性(C). 健壮性(D). 输入性2.设S为C语言的语句,计算机执行下面算法时,算法的时间复杂度为()。
for(i=n-1;i>=0;i--)for(j=0;j<i;j++) S;(A)、n2(B). O(nlgn) (C). O(n) (D). O(n2)3.折半查找法适用于()。
(A)、有序顺序表(B)、有序单链表(C)、有序顺序表和有序单链表都可以(D)、无限制4.顺序存储结构的优势是()。
(A)、利于插入操作(B)、利于删除操作(C)、利于顺序访问(D)、利于随机访问5.深度为k的完全二叉树,其叶子结点必在第()层上。
(A)、k-1 (B)、k (C)、k-1和k (D)、1至k6.具有60个结点的二叉树,其叶子结点有12个,则度过1的结点数为()(A)、11 (B)、13 (C)、48 (D)、377.图的Depth-First Search(DFS)遍历思想实际上是二叉树()遍历方法的推广。
(A)、先序(B)、中序(C)、后序(D)、层序8.在下列链队列Q中,元素a出队的操作序列为()((B)、p=Q.front->next; Q.front->next=p->next;(C)、p=Q.rear->next; p->next= Q.rear->next;(D)、p=Q->next; Q->next=p->next;9. Huffman树的带权路径长度WPL等于()(A)、除根结点之外的所有结点权值之和(B)、所有结点权值之和(C)、各叶子结点的带权路径长度之和(D)、根结点的值10.线索二叉链表是利用()域存储后继结点的地址。
第三讲 亚线性算法例析

=#N1+#N2 (#Ni: 最小生成树中权重至少为i的边的 数量)
=n-1+#N2 (最小生成树有n-1条边) =n-1+权重为1边构成的导出子图的联通分量数-1
最小生成树和连通分量的关系
• 一般的情况
– Gi: G中包含所有权重小于i的边的子图
������−1 ������=1
������������ − ������������
≤
������
⟺ 我们有几个减少计数器的步骤?
整个结构的权重(计数器的和)记作������′
整个数据流的权重(全部元素的数量)是������
每一个计数器降低的步骤减少������个计数,但是并未计入 输入元素的此次出现,即������ + 1 次未计入的元素出现.
⇒
最多有������−������′
������+1
– 运行时间和n无关
估计连通分量的方法:核心思想
• C:联通分量的个数
• 对于每个结点u, nu: u所在连通分量的结点数
•
对于每个连通分量:
������∈������
1 ������������
=
1
,
• 故:
������∈������
1 ������������
=
������
• 通过估计抽样顶点的nu来估计这个和
2/,因此0
<
1 ������������
−
1 ������������
<
1 ������������
=
������ 2
• 在这种情况下,对C的估计
数据结构试题及答案()

1. 1.数据结构是指数据及其相互之间的______________。
当结点之间存在M对N(M:N)的联系时,称这种结构为_____________________。
2. 2.队列的插入操作是在队列的___尾______进行,删除操作是在队列的____首______进行。
3. 3.当用长度为N的数组顺序存储一个栈时,假定用top==N表示栈空,则表示栈满的条件是___top==0___(要超出才为满)_______________。
4. 4.对于一个长度为n的单链存储的线性表,在表头插入元素的时间复杂度为_________,在表尾插入元素的时间复杂度为____________。
5. 5.设W为一个二维数组,其每个数据元素占用4个字节,行下标i从0到7 ,列下标j从0到3 ,则二维数组W的数据元素共占用_______个字节。
W中第6 行的元素和第4 列的元素共占用_________个字节。
若按行顺序存放二维数组W,其起始地址为100,则二维数组元素W[6,3]的起始地址为__________。
6. 6.广义表A= (a,(a,b),((a,b),c)),则它的深度为____________,它的长度为____________。
7.7.二叉树是指度为2的____________________树。
一棵结点数为N的二叉树,其所有结点的度的总和是_____________。
8.8.对一棵二叉搜索树进行中序遍历时,得到的结点序列是一个______________。
对一棵由算术表达式组成的二叉语法树进行后序遍历得到的结点序列是该算术表达式的__________________。
9.9.对于一棵具有n个结点的二叉树,用二叉链表存储时,其指针总数为_____________个,其中_______________个用于指向孩子,_________________个指针是空闲的。
10.10.若对一棵完全二叉树从0开始进行结点的编号,并按此编号把它顺序存储到一维数组A中,即编号为0的结点存储到A[0]中。
数据结构详细笔记
第1章绪论◆基本概念:数据、数据元素、数据对象、数据结构、数据类型、抽象数据类型。
数据——所有能被计算机识别、存储和处理的符号的集合。
数据元素——是数据的基本单位,具有完整确定的实际意义。
数据对象——具有相同性质的数据元素的集合,是数据的一个子集。
数据结构——是相互之间存在一种或多种特定关系的数据元素的集合,表示为:Data_Structure=(D, R)数据类型——是一个值的集合和定义在该值上的一组操作的总称。
抽象数据类型——由用户定义的一个数学模型与定义在该模型上的一组操作,它由基本的数据类型构成。
◆算法算法:是指解题方案的准确而完整的描述。
算法不等于程序,也不等计算机方法,程序的编制不可能优于算法的设计。
算法的基本特征:是一组严谨地定义运算顺序的规则,每一个规则都是有效的,是明确的,此顺序将在有限的次数下终止。
特征包括:(1)可行性;(2)确定性,算法中每一步骤都必须有明确定义,不充许有模棱两可的解释,不允许有多义性;(3)有穷性,算法必须能在有限的时间内做完,即能在执行有限个步骤后终止,包括合理的执行时间的含义;(4)拥有足够的情报。
算法的基本要素:一是对数据对象的运算和操作;二是算法的控制结构。
指令系统:一个计算机系统能执行的所有指令的集合。
基本运算和操作包括:算术运算、逻辑运算、关系运算、数据传输。
算法的控制结构:顺序结构、选择结构、循环结构。
算法基本设计方法:列举法、归纳法、递推、递归、减斗递推技术、回溯法。
算法复杂度:算法时间复杂度和算法空间复杂度。
算法时间复杂度是指执行算法所需要的计算工作量。
算法空间复杂度是指执行这个算法所需要的内存空间。
for ( i = 1 , i < = 10 , i++ ) x=x+c; =>O(1)for ( i = 1 , i < = n , i++ ) x=x+n; =>O(n)多嵌套一个for,则为=>O(n^2) 以此类推真题难点:i = 1,while(i < = n)i = i * 3;=>O(log3^n)i = i * 2;=>O(log2^n) 以此类推数据的逻辑结构有以下两大类:线性结构:有且仅有一个开始结点和一个终端结点,且所有结点都最多只有一个直接前驱和一个直接后继。
The Quadratic Assignment Problem
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :
9 Available Computer Codes for the QAP 10 Polynomially Solvable Cases 11 QAP Instances with Known Optimal Solution 12 Asymptotic Behavior 13 Related Problems
11 11 12 13
5 QAP Polytopes
14
This research has been supported by the Spezialforschungsbereich F 003 \Optimierung und Kontrolle", Projektbereich Diskrete Optimierung. y Technische Universitat Graz, Institut fur Mathematik B, Steyrergasse 30, A-8010 Graz, Austria. z Center for Applied Optimization, Industrial and Systems Engineering Department, University of Florida, Gainesville, FL 32611
: : : : : : : : : : : : : : : : : : : : : : : : :
On Maximizing the Second Smallest Eigenvalue of a
On Maximizing the Second Smallest Eigenvalue of aState-Dependent Graph LaplacianYoonsoo Kim and Mehran MesbahiAbstract—We consider theset consisting of graphs of fixed order andweighted edges.The vertex set of graphsinwill correspond to point masses and the weight for an edge between two vertices is a functional of the distance b etween them.We pose the prob lem of finding the b est vertex po-sitional configuration in the presence of an additional proximity constraint,in the sense that,the second smallest eigenvalue of the corresponding graph Laplacian is maximized.In many recent applications of algeb raic graph theory in systems and control,the second smallest eigenvalue of Laplacian has emerged as a critical parameter that influences the stability and ro-bustness properties of dynamic systems that operate over an information network.Our motivation in the present work is to “assign”this Laplacian eigenvalue when relative positions of various elements dictate the intercon-nection of the underlying weighted graph.In this venue,one would then b e able to “synthesize”information graphs that have desirable system theo-retic properties.Index Terms—Euclidean distance matrix,graph Laplacian,networked dynamic systems,semidefinite programming.I.I NTRODUCTIONConsider the set of n mobile elements as vertices of a graph,with the edge set determined by the relative positions between the respective elements.Specifically,we let G denote the set of graphs of order n with vertex set V =f 1;2;...;n g and edge set E =f e ij ;i =1;2;...;n 01;j =2;...;n;i <j g with the weight functionw :R 32R 3!R +assigning to eachedge e ij ,a function of the distance between the two nodes i and j .Thus,we havew ij :=w (x i ;x j )=f (k x i 0x j k )(1)for some f :R +!R +,with x i 2R 3denoting the position of ele-ment i .In our setup the function f in (1)will be required to exhibit a distinct behavior as it traverses the positive real line.For example,we will require that this function assume a constant value of one when the distance between i and j is less than some threshold and then rapidly drop to zero (or some small value)as the distance between these el-ements increases.Such a requirement parallels the behavior of an in-formation link in a wireless network where the signal power at the re-ceiver side is inversely proportional to the some power of the distance between transmitting and receiving elements [18].Using this frame-work,we now consider the configuration problem3:maxx2(L G (x ))(2)where x :=[x 1;x 2;...;x n ]T 2R 3n is the vector of positions for the distributed system,the matrix L G (x )is a weighted graph Laplacian defined element-wise as[L G (x )]ij:=0w ij ;if i =js =iw is ;if i =j(3)Manu script received April 29,2004;revised March18,2005and Au gu st 1,2005.Recommended by Associate Editor C.D.Charalambous.This work was supported by the National Science Foundation under Grant NSF/CMS-0301753.Y .Kim is withth e Department of Engineering,University of Leicester,Lei-ceister LE17RH,U.K.(e-mail:yk17@).M.Mesbahi is with the Department of Aeronautics and Astronautics,Univer-sity of Washington,Seattle,W A 98195-2400USA (e-mail:mesbahi@).Digital Object Identifier 10.1109/TAC.2005.861710and 2(L G (x ))denotes the second smallest eigenvalue of the state-dependent Laplacian matrix L G (x )withits spectru m ordered as1(L G ) 2(L G ) 111 n (L G ):Furthermore,we restrict the feasible set of (2)by imposing the prox-imity constraintd ij :=k x i 0x j k 2 1;for all i =j (4)preventing the elements from getting arbitrary close to each other intheir desire to maximize 2(L G )in (2).The second smallest eigenvalue of the graph Laplacian L G ,also known as the algebraic connectivity of G [4],[8],[14],has emerged as an important parameter in many systems problems defined over net-works [7],[12],[15],[17],[20].In fact,in several recent works [7],[17],[19],it has been observed that 2(L G )is a measure of stability and robustness of the networked dynamic system.This observation im-plies,for example,that small perturbations in the configuration of the networked system will be attenuated back to its equilibrium state(s)witha rate th at is proportional to 2(L G ).When this important graph parameter is considered in a state-dependent setting as proposed in [15],the characterization of a distributed system states that maximize 2(L G )emerges as a natural optimization problem.In this venue how-ever,there are only a handful of studies in the literature that are re-lated to su cha grapheigenvalu e assignment problem (2).In particu lar we mention the work of Fallat and Kirkland [6]where a graph-the-oretical approachh as been proposed to extremize 2(L G )over the set of trees of fixed diameter.Also related to the present work are those by Chung and Oden [5]pertaining to bounding the gap between the first two eigenvalues of graph Laplacians,and Berman and Zhang [2]and Guattery and Miller [11],where,respectively,isoperimetric numbers of weighted graphs and graph embeddings are employed for lower bounding the second smallest Laplacian eigenvalue.We note that maximizing the second smallest eigenvalue of state dependent graph Laplacians over arbitrary graphconstraints is a difficu lt compu tational problem [16].The contribution of this note is to propose an iterative greedy-type algorithm for problem (2)with a guaranteed local conver-gence behavior.Although the convergence of this algorithm is provably local in nature,extensive simulations suggest that it often converges to the global maximum when the initial graph is taken to be a path.The outline of the note is as follows.In Section II-A we delineate on the various possible choices for the edge weights for our state-depen-dent weighted Laplacians.Sections II-B and C are devoted to the main result of the note where an iterative semidefinite programming-based approachis proposed for th e solu tion of problem 3(2).A numerical example is then presented in Section III followed by a few concluding remarks.A few words on the notation.The 2-norm of vector x will be denoted by k x k .The spaces of n 2n real matrices and n 2n real symmetric matrices are designated by R n 2n and S n ,respectively;I n will be the n 2n identity matrix.The inequalities between symmetric matrices are interpreted in the sense of Löwner ordering,i.e.,A >B and A B indicate,respectively,the positive definiteness and positive semidefi-niteness of the matrix difference A 0B .II.M ETHODAs we mentioned in Section I,the general formulation of the problem 3(2)does not readily hint at being tractable,in the sense of admit-ting an efficient algorithm for its solution.Generally,maximizing the second smallest eigenvalue of a symmetric matrix subject to matrix inequalities,does not yield to a standard linear matrix inequality ap-proach[3]and,su bsequ ently,a solu tion procedu re th at relies solely0018-9286/$20.00©2006IEEEFig.1.Several candidates for the function f in(1)where =1and =2.on an interior point method[1].The previous complication however is alleviated in case of graph Laplacians,where the smallest eigenvalue 1(L G)is always zero withth e associated eigenvector of1composed of unit entries.This observation follows directly from the definition(3). Nevertheless,due to the nonlinear dependency of entries of L G on the relative distance d ij and the presence of constraints(4),the problem 3(2)assumes the form of a nonconvex optimization.In light of this fact,we will proceed to propose an iterative SDP-based approachfor this problem.However,before we proceed,we make a few remarks on some judicious choices for the function f in(1).The choice of f in(1)is not only guided by particular applications but also by numerical considerations.A few candidate functions are shown in Fig.1.Although there are a host of choices for f,for our analysis and numerical experimentation we have chosen to work with Type-IV functions(the lower right corner in Fig.1),where f assumes the formf(d ij)= ( 0d)=( 0 ); >0(5) given that d ij 1.1We note that f( 1)=1and f( 2)= .Among the advantages of working with functions(5)are their differentiability properties,as well as their ability to capture a situations that is of prac-tical relevance.In many su chsitu ations,th e strengthof an information link is inversely proportional to the relative distance and decays expo-nentially after a given threshold is passed.Furthermore,and possibly more importantly,functions(5)lead to a stable algorithm for our nu-merical experimentation;a representative set of examples is discussed in Section III.1We have also used functions of the form(1=d),where is a positive number and f( )= .Our simulation results in Section III turned out to be exactly the same for these functions as compared with those obtained using functions of the form(5).A.Maximizing 2(L G)Wefirst present a linear algebraic resu lt in conju nction withth e gen-eral problem of maximizing the second smallest eigenvalue of graph Laplacians.Proposition2.1:Consider the m-dimensional subspace P R n spanned by the vectors p i2R n,i=1;...;m.Denote P:=[p1;...;p m]2R n2m.Then,for M2S n one hasx T Mx>0for all nonzero x2Pif and only ifP T MP>0:(6)Proof:An arbitrary nonzero element x2P can be written asx= 1p1+ 2p2+111+ m p mfor some 1;...; m2R,not all zeros and,thus,x=P y,where y:=[ 1; 2;...; m]T.Consequently,thefirst inequality in(6)is equivalent to(P y)T M(P y)=y T P T MP y>0for all nonzero y2R m,or in other words,having P T MP>0;we note that P T MP2S m.Corollary2.2:For a graphLaplacian L G the constraint2(L G)>0(7) is equivalent toP T L G P>0(8)where P=[p1;p2;...;p n01],and the unit vectors p i2R n are chosen such thatp T i1=0;(i=1;2;...;n01)andp T i p j=0;(i=j):(9) Proof:It is well-known that for G2GL G 0and L G1=0(10)and,thereby,the smallest eigenvalue of L G is always zero and rank L G n01.This implies that(7)is equivalent to havingx T L G x>0;for all nonzero x21?(11) where1?:=f x2R n j1T x=0g:(12)In view of Proposition2.1,the condition(11)is equivalent to having P T L G P>0,with P denoting the matrix of vectors spanning the subspace1?.Without loss of generality,this subspace can be identified withth e basis u nit vectors satisfying(9).Corollary2.3:The problem3(2)is equivalent to3:maxx(13)s:t:d ij:=k x i0x j k2 1(14)P T L G(x)P I n01(15)where i=1;2;...;n01,j=2;...;n,i<j,and the pairwise or-thogonal unit vectors p0i s forming the columns of P span the subspace 1?(12).Proof:The proof follows from Corollary2.2.One of the consequences of Corollary2.3pertains to the following graphsynth esis problem2:determine graphs satisfying an upper bound on the number of their edges with maximum smallest second Laplacian eigenvalue.Although this problem will not be further considered in this note,we point out that it can be reformulated asmaxG2Gf j Trace L G ;P T L G P I n01gwhere P is defined as in Corollary2.3and is twice the maximum number of edges allowed in the desired graph.In this venue,a compli-cation that needs to be further addressed pertains to the integrality of the entries of the sought matrix L G.B.Discrete and GreedyWe now proceed to view the problem3(2)in an iterative setting, where the goal is shifted towardfinding an algorithm that attempts to maximize the second smallest eigenvalue of the graph Laplacian at each step.Toward this aim,wefirst differentiate(14)with respect to time as 2f_x i(t)0_x j(t)g T f x i(t)0x j(t)g=_d ij(t)(16) and then employ Euler’sfirst discretization method,with1t as the sampling timex(t)!x(k);_x(t)!x(k+1)0x(k)1t2This connection was pointed to us by one of the referees.to rewrite(14)as2f x i(k+1)0x j(k+1)g T f x i(k)0x j(k)g=d ij(k+1)+d ij(k): Similarly,the state dependent Laplacian L G(x)in(15)is discretized by first differentiating the terms w ij with respect to time,and then having w ij(k+1)=w ij(k)0 ( 0d(k))=( 0 )f d ij(k+1)0d ij(k)grecall that we are employing functions of the form(5)in(1).The dis-crete version of the state dependent Laplacian,L G(k),assumes the form[L G(k)]ij=0w ij(k);if i=js=iw is(k);if i=j.Putting it all together,we arrive at the iterative step of solving the op-timization problem3k:maxx(k+1)(17)s:t:2f x i(k+1)0x j(k+1)g T f x i(k)0x j(k)g=d ij(k+1)+d ij(k)(18)d ij(k+1) 1(19)P T L G(k+1)P I n01(20)for i=1;2;...;n01,j=2;...;n,i<j,and x(k):= [x1(k);x2(k);...;x n(k)]T2R3n.Thereby,the algorithm is ini-tiated at time k=0withan initial graph(configu ration)G0,and then for k=0;1;2;...,we proceed to iterativelyfind a graphth at maximizes 2(L G(k+1)).This greedy procedure is then iterated upon until the value of 2(L G(k))can not be improved further.We note that the proposed greedy algorithm converges,as the sequence generated by it is nondecreasing and bounded from above.3C.Further ConsiderationsIn previous section,we proposed an algorithm that converges to a local optimal vertex positional configuration,in terms of maximizing the quantity 2(L G).However,by replacing the nonconvex constraint (14)withits linear approximation(18)–(19),one introdu ces a poten-tial inconsistency between the position and the distance vectors.In this section,we provide two remedies to avoid such potential com-plications.Let usfirst recall the notion of Euclidean distance matrix (EDM).Given the position vectors x1;x2;...;x n2R3,the EDM D=[d ij]2R n2n is defined entry-wise as[D]ij=d ij=k x i0x j k2;for i;j=1;2;...;n:The EDM matrices are nicely characterized in terms of linear matrix inequalities[10].Theorem2.4:A matrix D=[d ij]2R n2n is an EDM if and only ifJDJ 0(21)d ii=0;for i=1;2;...;n(22) where J:=I n011T=n.3The second smallest eigenvalue ofL for a graphof order n is bounded from above by n01[9].Fig.2.Trajectory generated by the proposed algorithm for six nodes in R:the configuration evolves from a path(circles)to a truss(squares).Fig.3.Trajectory generated by the proposed algorithm for six nodes in R:the configuration evolves from a path(circles,1;...;6)to an octahedron(squares, 1;...;6).Theorem2.4allows us to guarantee that by adding the two convexconstraints(21)–(22)to problem3k(17)–(20),we always obtainconsistency among the position and distance variables at each iterationstep.Moreover,by updating the values of d ij(k)’s and[L(k)]ij’s in(18)and(20)after calculating the values of x(k),we can furtherreduce the effect of linearization in the proposed procedure.To furtherexpand on this last point,suppose that x1(k);x2(k);...;x n(k), d ij(k)’s and[L(k)]ij,i=1;2;...;n01,j=2;...;n,i<j,h ave been obtained after solving the problem3k(17)–(20).Our proposed modification to the original algorithm thus amounts to updating the values of d ij(k)and[L(k)]ij,based on the computed values of x1(k);x2(k);...;x n(k),before initiating the next iteration.III.S IMULATION R ESULTSFor our simulations we used SeDuMi[1]to solve the required semidefinite programs.Fig.2depicts the behavior of six mobile elements under the guidance of the proposed algorithm,leading to a planar configuration that locally maximizes 2(L G).The constants , 1,and 2in(5)are chosen to be0.1,1,and1.5,respectively. The algorithm was initialized with a configuration that corresponds to a path.The sequence of configurations thereafter converges to the truss-shape graph with the 2(L G)of1.6974.For these set of param-eters,the truss-shape graph as suggested by the algorithm is the global maximum over the set of graphs on six vertices that can be configured in R2.4Using the same simulation scenario,but this time,in search of an optimal positional configuration in R3,the algorithm leads to the trajectories shown in Fig.3.In this case,the graph sequence converges to an octahedron-shape configuration with 2(L G)=4:02. Increasing the number of nodes to eight,the algorithm was initial-ized as the unit cube;the resulting trajectories are shown in Fig.4.4A global maximum may be found in the following exhaustive manner:First, define a space large enou ghgu aranteed to contain th e optimal configu ration. Then grid this region and search over the set of all n grid points for the config-uration that leads to maximum (L).Fig.4.Evolution of the proposed algorithm for eight nodes in R :the configuration evolves from 3-cube (circles)to octahedron (squares).TABLE IC OMPARING THE V ALUES FOR THE T YPE -IV W EIGHTED G RAPH G AS R EALIZED BY THE A LGORITHM AND T HOSE C ORRESPONDING TO THEA SSOCIATED 0–1W EIGHTED G RAPHGIn this figure,the edges between vertices i and j indicate that d ij 2=1:5.The solid lines in Fig.4represent the final configuration with 2(L G )=2:7658.Once again,an exhaustive search procedure indicates that the proposed algorithm does lead to the global optimal configuration (see Table I).We like to remark however that the choice for the function f in (5)and the initial configuration,are critical to the performance of the proposed algorithm.For example,when this func-tion is chosen to be of Type-I in Fig.1and the initial graph as a dis-connected graph,the algorithm terminates right after initialization,as any small perturbation on the initial graph does not lead to an improve-ment in the value of 2(L G ).Choosing a Type-IV function in Fig.1on the other hand,always lead to a connected configuration with a posi-tive 2(L G ),even when the algorithm is initialized via a disconnected graph.IV .C ONCLUDING R EMARKSWe considered the problem of maximizing the second smallest eigenvalu es of a state-dependent graphLaplacian.Th is problem is of importance,for example,when the positions of a set of dynamic elements-operating over an information network-can be chosen for robust system performance.We proposed an iterative algorithm for this problem that employs a semidefinite programming solver at each recursive step.Although the algorithm has a local convergence behavior,extensive simulations suggest that it often leads to a globally optimal state configuration.A CKNOWLEDGMENTThe authors gratefully acknowledge suggestions and comments by the anonymous reviewers.R EFERENCES[1]SeDuMi.McMaster Univ..[Online].Available:http://sedumi.mc-master.ca[2] A.Berman and X.-D.Zhang,“Lower bounds for the eigenvalues of Laplacian matrices,”Linear Alg.Appl.,vol.316,pp.13–20,2000.[3]S.Boyd and L.Vandenberghe,Convex Programming .Cambridge,U.K.:Cambridge Univ.Press,2003.[4] F.R.K.Chung,Spectral Graph Theory .Providence,RI:AMS,1997.[5]F.R.K.Chung and K.Oden,“Weighted graph Laplacians and isoperi-metric inequalities,”Pacific J.Math.,vol.192,no.2,pp.257–273,2000.[6]S.Fallat and S.Kirkland,“Extremizing algebraic connectivity subject to graphth eoretic constraints,”Elect.J.Linear Alg.,vol.1,no.3,pp.48–74,1998.[7]J.A.Fax and R.M.Murray,“Information flow and cooperative control of vehicle formations,”IEEE Trans.Autom.Control ,vol.49,no.9,pp.1465–1476,Sep.2004.[8]M.Fiedler,“A property of eigenvectors of nonnegative symmetric ma-trices and its applications in graphth eory,”Czech.Math.J.,vol.100,no.26,pp.619–633,1975.[9] C.Godsil and G.Royle,Algebraic Graph Theory .New York:Springer-Verlag,2001.[10]J.Gower,“Properties of Euclidean and non-Euclidean distance ma-trices,”Linear Alg.Appl.,vol.1,no.67,pp.81–97,1985.[11]S.Guattery and ler,“On the quality of spectral separators,”SIAM J.Matrix Anal.Appl.,vol.19,no.3,pp.701–719,1998.[12] A.Jadbabaie,J.Lin,and A.S.Morse,“Coordination of groups of mobile autonomous agents using nearest neighbor rules,”IEEE Trans.Autom.Control ,vol.48,no.9,pp.988–1001,Sep.2003.[13]Y .Kim and M.Mesbahi,“Quadratically constrained attitude control via semidefinite programming,”IEEE Trans.Autom.Control ,vol.49,no.5,pp.731–735,May 2004.[14]R.Merris,“Laplacian matrices of graphs:A survey,”Linear Alg.Appl.,vol.197,no.1,pp.143–176,1994.[15]M.Mesbahi,“On state-dependent dynamic graphs and their control-lability properties,”IEEE Trans.Autom.Control ,vol.50,no.3,pp.387–392,Mar.2005.[16]H.Q.Ngo and D.-Z Du,“Notes on the complexity of switching net-works,”in Advances in Switching Networks ,H.Q.Ngo and D.-Z.Du,Eds.Norwell,MA:Kluwer,2000,pp.307–357.[17]R.Olfati-Saber and R.M.Murray,“Consensus problems in networks of agents withswitch ing topology and time-delays,”IEEE Trans.Autom.Control ,vol.49,no.9,pp.1520–1533,Sep.2004.[18]K.Pahlavan and A.H.Levesque,Wireless Information Networks .New York:Wiley,1995.[19]H.Tanner, A.Jadbabaie,and G.Pappas,“Flocking in fixed and switching networks,”Automatica,submitted for publication.[20]L.Xiao and S.Boyd,“Fast linear iterations for distributed averaging,”Syst.Control Lett.,vol.53,pp.65–78,2004.。
中南大学十套数据结构试题及答案2
数据结构试卷(一)一、单选题(每题2 分,共20分)1.栈和队列的共同特点是( )。
A。
只允许在端点处插入和删除元素B.都是先进后出C.都是先进先出D。
没有共同点2.用链接方式存储的队列,在进行插入运算时( )。
A. 仅修改头指针 B。
头、尾指针都要修改C。
仅修改尾指针 D.头、尾指针可能都要修改3.以下数据结构中哪一个是非线性结构?( )A。
队列 B. 栈C。
线性表 D. 二叉树4.设有一个二维数组A[m][n],假设A[0][0]存放位置在644(10),A[2][2]存放位置在676(10),每个元素占一个空间,问A[3][3](10)存放在什么位置?脚注(10)表示用10进制表示。
A.688 B.678 C.692 D.6965.树最适合用来表示( ).A。
有序数据元素 B.无序数据元素C.元素之间具有分支层次关系的数据D。
元素之间无联系的数据6.二叉树的第k层的结点数最多为( ).A.2k-1 B。
2K+1 C.2K-1 D。
2k—17.若有18个元素的有序表存放在一维数组A[19]中,第一个元素放A[1]中,现进行二分查找,则查找A[3]的比较序列的下标依次为( )A. 1,2,3B. 9,5,2,3C. 9,5,3 D。
9,4,2,38.对n个记录的文件进行快速排序,所需要的辅助存储空间大致为A。
O(1) B. O(n) C. O(1og2n) D. O(n2)9.对于线性表(7,34,55,25,64,46,20,10)进行散列存储时,若选用H(K)=K %9作为散列函数,则散列地址为1的元素有()个,A.1 B.2 C.3 D.410.设有6个结点的无向图,该图至少应有()条边才能确保是一个连通图。
A。
5 B。
6 C。
7 D.8二、填空题(每空1分,共26分)1.通常从四个方面评价算法的质量:_________、_________、_________和_________.2.一个算法的时间复杂度为(n3+n2log2n+14n)/n2,其数量级表示为________.3.假定一棵树的广义表表示为A(C,D(E,F,G),H(I,J)),则树中所含的结点数为__________个,树的深度为___________,树的度为_________。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
TAIWANESEJOURNALOFMATHEMATICSVol.3,No.1,pp.73-81,March1999
ALGORITHMICASPECTSOFLINEARk-ARBORICITYGerardJ.Chang∗
Abstract.Forafixedpositiveintegerk,thelineark-arboricitylak(G)ofagraphGistheminimumnumbersuchthattheedgesetE(G)canbepartitionedintodisjointsets,eachinducesasubgraphwhosecomponentsarepathsoflengthsatmostk.Thispaperexamineslineark-arboricityfromanalgorithmicpointofview.Inparticular,wepresentalinear-timealgorithmfordeterminingwhetheratreeThasla2(T)≤m.WealsogiveacharacterizationforatreeTwithmaximumdegree2mhavingla2(T)=m.
1.IntroductionAllgraphsinthispaperaresimple,i.e.,finite,undirected,loopless,andwithoutmultipleedges.Alineark-forestisagraphwhosecomponentsarepathsoflengthsatmostk.Alineark-forestpartitionofGisapartitionoftheedgesetE(G)intolineark-forests.Thelineark-arboricityofG,denotedbylak(G),istheminimumsizeofalineark-forestpartitionofG.Thenotionoflineark-arboricitywasintroducedbyHabibandPeroche[18].ItisanaturalrefinementofthelineararboricityintroducedbyHarary[20],whichisthesameaslineark-arboricityexceptthatthepathshavenolengthconstraints.Supposeχ(G)isthechromaticindexofGandla(G)thelineararboricity.Let∆(G)denotethemaximumdegreeofavertexinG.Thefollowingpropositionsareeasytoverify.
Proposition1.IfGisasubgraphofH,thenlak(G)≤lak(H)fork≥1.0ReceivedOctober8,1997.
CommunicatedbyS.-Y.Shaw.1991MathematicsSubjectClassification:05C85,05C70.Keywordsandphrases:Linearforest,lineark-forest,lineararboricity,lineark-arboricity,tree,leaf,penultimatevertex,algorithm,NP-complete.∗SupportedinpartbytheNationalScienceCouncilundergrantNSC86-2115-M009-002.
7374GerardJ.Chang
Proposition2.IfGisagraphwithnvertices,thenla(G)=lan−1(G)≤lan−2(G)≤···≤la2(G)≤la1(G)=χ(G).Proposition3.IfGisagraphwithnverticesandmedges,thenlak(G)≥max∆(G)2,mknk+1.Ontheotherhand,HabibandPeroche[18]madethefollowingconjecture.Conjecture4.([18])IfGisagraphwithnverticesandk≥2,thenlak(G)≤∆(G)n+α2knk+1,whereα=1when∆(G)
∆(G)=n−1.
ThisconjecturesubsumesAkiyama’sconjecture[2]asfollows.Conjecture5.([2])la(G)≤∆(G)+12.Considerableworkhasbeendoneindeterminingexactvaluesandboundsforlineark-arboricity,aimedattheseconjectures(seethereferencesattheendofthispaper).Weexaminelineark-arboricityfromanalgorithmicpointofviewinthispaper.HabibandPeroche[19]showedthefirstresultsalongthisline.TheygaveanalgorithmforprovingthatifTisatreewithexactlyonevertexofmax-imumdegree2m,thenla2(T)≤m.Usingthisasabasisforinduction,theythencharacterizedatreeTwithmaximumdegree2mashavingla2(T)=m.However,theircharacterizationhasaflawasshowninSection2.Holyer[21]provedthatdeterminingla1(G)isNP-complete,Peroche[24]thatdetermin-ingla(G)isNP-complete,andBermondetal.[9]thatdeterminingwhetherla3(G)=2isNP-completeforcubicgraphsof4mvertices.Bermondetal.[9]conjecturedthatdetermininglak(G)foranyfixedkisNP-complete.Inthispaper,wepresentalinear-timealgorithmfordeterminingwhetheratreeThasla2(T)≤m.Weemploya“localmessagepassing”approachthatreducestheproblemonTtotheproblemonanothertreeTobtainedfromTbyalocalmodification.Wethengiveacharacterizationforatreewithmaximumdegree2mhavingla2(T)=m.ThismakesupagapofHabibandPeroche’sresult[19].AlgorithmicAspectsofLineark-Arboricity752.Linear2-arboricityonTreesAleafisavertexofdegreeone.Apenultimatevertexisavertexthatisnotaleafandallofwhoseneighborsareleaves,withthepossibleexceptionofone.Notethatapenultimatevertexofaconnectedgraphisalwaysadjacenttoanon-leaf,unlessthegraphisastar.Itiswell-knownthatanon-trivialtreehasatleasttwoleaves,andatreewithatleastthreeverticeshasatleastonepenultimatevertex.
Theorem6.ForanytreeT,la2(T)≤∆(T)+12.Proof.WeprovethistheorembyinductiononthenumberofverticesofT.ThetheoremistrivialwhenTisastar.WethusconsiderageneraltreeTthatisnotastar.Chooseapenultimatevertexxthatisadjacenttoanon-leafyandr≥1leavesx1,x2,...,xr.LetT=T−{x1,x2,...,xr}.Accordingtotheinductionhypothesis,la2(T)≤∆(T)+12≤∆(T)+12.TheedgesetE(T)canthenbepartitionedtoatmost∆(T)+12linear2-forests.Sincer+1=degT(x)≤∆(T),wehaver2≤∆(T)+12−1.Notethatthestarwithcenterxandleavesx1,x2,...,xrcanbepartitionedintor2pathsoflengthatmost2.Wethenaddthesepathstor2differentlinear2-forestsofTthatdonotcontaintheedgexytoformalinear2-forestpartitionofT.Thisprovesthatla2(T)≤∆(T)+12.
Theorem6andPropositions2and3yieldthefollowingtwoconsequences.Corollar7wasalsoobtainedbyHabibandPeroche[19]fromadifferentap-proach.
Corollary7.IfTisatreewith∆(T)=2m−1,thenlak(T)=mfork≥2.
Corollary8.IfTisatreewith∆(T)=2m,thenm≤lak(T)≤m+1fork≥2.