题目:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are label....
分类:
编程语言 时间:
2014-07-29 12:09:37
阅读次数:
388
http://www.graphviz.org/Download..phpDraw a undirect graph 1 graph g { 2 37 -- 22; 3 37 -- 83; 4 5 22 -- 19; 6 22 -- 31; 7 8 83 -- 64; 9 83 --...
分类:
其他好文 时间:
2014-07-29 12:04:06
阅读次数:
225
Cyclic Tour
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/65535 K (Java/Others)
Total Submission(s): 1478 Accepted Submission(s): 750
Problem Description
There are N cit...
分类:
其他好文 时间:
2014-07-28 16:03:13
阅读次数:
271
cut -- 将行根据需求分成指定的片段常用参数:-d 以。。。为分割符 -d: 以:分割行(类似于python中的split)-f 得到分割后的某个列 -f1-3 得到分割后的第1个到第3个列 (即1,2,3列,这里面是从1开始的,而不是0)-c 指定位置字符 -c1 得到行的第一个字符grep....
分类:
系统相关 时间:
2014-07-28 15:23:23
阅读次数:
234
A BFS usage.class Solution {public: UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) { if (!node) return NULL; UndirectedGr...
分类:
其他好文 时间:
2014-07-28 15:07:53
阅读次数:
266
Description
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.
The graph G is an ordered pair (V, E), where V is a set of vertices {v1,
v2, …, vn}...
分类:
其他好文 时间:
2014-07-27 11:48:33
阅读次数:
312
给n个点的有向图,边以邻接矩阵形式给出,如果为1则有边,为0无边。然后给出0时刻每个点的一个值,为0或1,输入一个T,输出-T时刻每个点的值:确定的话就输出,不确定的话按照题目要求输出error信息
题目背景:t时刻,每个点有一个值,那么t+1时刻,如果一个点发出的边的终点值为一的个数为奇数个,那么t+1时刻这个点的值就是1;否则为0...
分类:
其他好文 时间:
2014-07-27 11:47:03
阅读次数:
236
题目:uva10720 - Graph Construction(Havel-Hakimi定理)
题目大意:给出N个点,并且给出每个点的度,问能否形成简单图。
解题思路:一开始自己写想了些形成简单图的条件,例如度数之和是偶数,度数的一半也就是简单图的边不能超过n * (n - 1) / 2,每个顶点的度数都应该小于总的顶点个数,但后面发现这些只是必要的条件。后来看了题解发现大神...
分类:
其他好文 时间:
2014-07-27 11:37:06
阅读次数:
202
Description
Given a connected undirected graph, tell if its minimum spanning tree is unique.
Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of...
分类:
其他好文 时间:
2014-07-26 17:19:22
阅读次数:
401
下面是求割點的模板,還有cut_vertex_num[]數組(array)記錄了哪些是割點
Int cut_vertex_num[];
void dfs(int cur,int pa)
{
int child=0,flag=0,i;
low[cur]=dfn[cur]=++depth;
for(i=0;i<adj[cur].size();i++)
{
i...
分类:
其他好文 时间:
2014-07-26 15:32:23
阅读次数:
289