Topic Link http://poj.org/problem?id=3522kruskal+ and check the collection, attention to special cases such as 1, 0, 0, 1,1#include 2#include 3#include 4#include 5 using namespacestd;6 #defineMAXN 50057 structedge{8 intU,v,cost;9 };Ten intCompConstedge E1,ConstedgeE2) { One returne1.costE2.cost; A } - Edge ES[MAXN]; - intv,e; the intPAR[MAXN],RANK[MAXN]; - voidinit () { - for(intI=1; i){ -par[i]=i; + } - } + intFindintx) { A if(par[x]==x)returnx; at returnpar[x]=find (par[x]);
to operate.Formally, if G1 = (V1, E1) and G2 = (V2, E2) are game graphs, then their and gsum = (Vsum, esum) are defined as:Vsum = V1xv2,Esum = {(V1v2, w1v2) | (v1, W1) ∈e1}∪{(V1V2, v1w2) | (v2, W2) ∈e2}.Now, suppose we give two games G1 and G2. If we only know the P-state and N-states of individual games can we play good games and G1 + G2 correctly? The answer is in the negative. It is not difficult to see
. torowvector, matrix. transpose, etc.Sparse matrix
Let D = matrix. initsparse 3 3 [(1.0, 2.0); (3.0,); (,);]
// init a sparse 3-by-3 matrix//val it : matrix = matrix [[1.0; 0.0; 0.0]// [0.0; 2.0; 0.0]// [0.0; 0.0; 3.0]]D.IsSparse // sparse test
Let E = matrix. initsparse 100000 100000 [(1.0, 2.0); (3.0,); (,);]
let Esum = Matrix.sum E
However, map, fold, exists,... are not supported on sparse matrix.I
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.