Reprinted from http://blog.csdn.net/jnu_simba/article/details/8867687
algorithm: Graph depth First Search (Depth)Category: Data structure and algorithm 2013-04-30 09:19 1723 people read comments (2) Favorites Search by traversal depth of the report map
The traversal of the graph is similar to the traversal of the tree, and we want to go through the rest of the graph from one vertex in the graph, and make each vertex accessible only once, a process called graph traversal (Traverse graph).
There
The graph consists of a poor non-empty vertex set V and a side e. Each edge is a point pair (v,w). The data elements in the diagram are called vertices . If the point pair is ordered (the next point of each point is fixed), then the graph is called a forward graph , otherwise there is no graph . The value associated with the edge of the graph is called the weighted value , and the weighted graph is called the Net (network ).
Simple concepts related to graphs
/*** Gubotao* Date: 2015-2-26* E-mail:[email protected]**/1. First inconsistency: The Controller runtime's real-time statistics are inconsistent with the statistical data in the analysis results file. cause Analysis:Controller real-time data statistics sampling frequency and analysis the default data statistics sampling frequency may be different (general controller is 5 seconds, analysis is 1 seconds), so the statistical data obtained by the two different statistical results are different;Worka
Zabbix Special Topic: Seventh Chapter Add image graphs, add display screen screensInterested in Linux friends join QQ Group: 476794643 Online communicationThis article anti-theft chain: http://zhang789.blog.51cto.comOutline of this program
Add Image graphs
Adding aggregation graphics Screens
Add Image graphs
If we want to display multip
removed is connected, then the directed graph is called weakly connected. A full graph is a graph with one edge between each pair of vertices.Two: the representation of graphsWe will consider the graph of the direction (the non-graph can be similar to the representation)A simple way to represent graphs is to use two-dimensional arrays, called adjacency matrix representations. For each edge (u,v), we set a[u][v]=1, Otherwise the array element is set t
table.
2. Adjacent matrix method: This method is suitable for dense graphs and can quickly determine whether two vertices are adjacent.
The adjacent matrix first numbers the vertices in the graph. 1... | v |, after the number, A | v | x | v | matrix is used to represent the graph. Whether the element AIJ in the matrix is 0 indicates whether there is an edge between VI and vj, the storage space of the matrix is O (| v | ^ 2), independent of the numbe
Single Source Shortest Path algorithmTime complexity O (N2) optimized time complexity is O (Mlogn) (M is the number of edges in the graph so it is optimized for sparse graphs faster)does not support a graph with negative weightsPost-optimization codeOptimization of Dijkstra algorithm #include Dijkstra and optimization of the shortest path algorithm for graphs
, matching edges , unmatched points , mismatched edges , and they are very obvious. Example 3, 1, 4, 5, 7 is the matching point, the other vertices are unmatched points, 1-5, 4-7 is the matching edge, the other edges are non-matching edges. Maximum match : A match with the largest number of matched edges in all matches of a graph, called the maximum match for this graph. Figure 4 is a maximum match that contains 4 matching edges.Perfect Match : if one of the
The graphs are primarily depth-first traversal (DFS) and breadth-first traversal (BFS).1 Depth-First traversal--dfsThe depth preference is similar to the first sequence traversal of a tree, starting from the node to be accessed (0), selecting any node adjacent to it (3), accessing it, then accessing it, and 3 adjacent nodes (4), accessing it until it accesses a node that has no neighboring nodes, such as 4 without adjacent nodes, then backtracking one
UI Advancedquartz2dhttp://ios.itcast.cn iOS AcademyMasterDrawRect: Use of methodsDrawing of common graphs: lines, polygons, circlesSettings for drawing state: text color, line width, etc.Save and restore Graphics context State (graphics context stack)Picture clippingWhat is quartz2dQuartz 2D is a two-dimensional drawing engine that supports both iOS and Mac systemsQuartz 2D can do the workØ Draw graphic: line \ triangle \ rectangle \ Circle \ Arc etc.
made me pay more attention to the initialization of parameters.banner_imgsstyle=" left: -800px; " >3. This problem compared to the pain, originally five map corresponding to five small squares, now more run out of two graphs, need to be modified, because the previous code understanding is not deep, so the change is always not, I always want to put the small box for the parameter I in the loop directly to the picture, for(varI=0, olen=oa.length;i) {Oa
Test instructionsGiven the N-point M-side of the graph, for the edge u,v, from the U to v Edge is C, from V to u Benquan is D, asked to be able to pass through each edge once and only once the minimum weight and.IdeasTwo-point answer mid, then cut the weight value is greater than the edge of the mid, the original image becomes a mixed graph with both a non-forward edge and a forward edge, then the problem is converted to find out whether there is a Euler loop on the mixed graph. undirected
http://www.luogu.org/problem/show?pid=1141To ask questions, the size of the sub-connected block of undirected graphs is sought.Direct BFS, read a search one, over 60;100% points 1,000,000 points, 100,000 queries, is obviously memory.I was weak, and I started out. The number group records the coordinates of the first point of each point belonging to the connected block, and then writes a bunch of them.Later asked a great God, like the mist to see the s
first, the basic terminologyFigure: Consists of a poor, non-empty point set and a set of edges, which is simply written in G (V,e);Vertex: The vertex in the graph: there is no direction for each edge in the graph: there is a direction in each edge of the graph; no edge: The Edge is no direction, and is written as (A, B) has a forward edge: The edge is a direction, is written as an edge is also an arc; the beginning vertex is called the arc tail;Simple diagram: There is no graph pointing to itsel
The traversal of graphs is divided into BFS width-first traversal and DFS depth-first traversal, the former takes the queue as the carrier and the latter with recursion as the carrier.adjacency Table Template:BFS1#include 2#include 3#include 4#include 5 using namespacestd;6 Const intMAXN =100000+Ten;7queueint>Q;8 intN, M, S, T, MS =0, Fch[maxn], ans =0;9 BOOLVIS[MAXN];Ten structtedge{ One intto, next; A }ADJ[MAXN]; - voidReadintx) { -x =0;intsig =
[bleg[v]]++; theMAT[BLEG[U]][BLEG[V]] =1; the } - } - } the the intTopo[n], k=0; the voidTopsort () the { -queueint>Q; the for(intI=1; i) the if(inde[i]==0) Q.push (i); the //printf ("Topsort: \ n");94k=0; the while(!q.empty ()) the { the intU =Q.front (); Q.pop ();98 //printf ("%d", u); AboutTOPO[++K] =u; - for(intI=1; i)101 {102 if(!mat[u][i])Continue;103inde[i]--;104 if(inde[i]==0) Q.push (i); the
Application of graphs-the implementation of searchThe search of the graph mainly includes two kinds of 1 are depth first search, one is breadth first search. Depth-First search as the name implies is always far away from the source search point, search down, depth-first search mechanism is a stack to achieve, breadth-first search algorithm is implemented by the queue, because the implementation of the mechanism is different, so the way to search is al
collection, and the number of vertices in the collection reaches the upper limitLargest group: Any two points in the collection have edges, and the number of vertices in the collection reaches the upper limitHungarian algorithm: Every time you look for an augmented path, if you can find a match plus 1The minimum vertex cover number of a binary graph = Two maximum match number of the graphMaximum number of independent sets of binary graphs = number of
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.